hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1102509 [2/3] - in /hadoop/hdfs/branches/HDFS-1073: ./ ivy/ src/c++/libhdfs/ src/contrib/hdfsproxy/ src/docs/src/documentation/content/xdocs/ src/java/ src/java/org/apache/hadoop/hdfs/ src/java/org/apache/hadoop/hdfs/server/datanode/ src/j...
Date Thu, 12 May 2011 23:34:51 GMT
Modified: hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/DataTransferTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/DataTransferTestUtil.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/DataTransferTestUtil.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/DataTransferTestUtil.java Thu May 12 23:34:50 2011
@@ -27,7 +27,6 @@ import org.apache.hadoop.fi.FiTestUtil.C
 import org.apache.hadoop.fi.FiTestUtil.CountdownConstraint;
 import org.apache.hadoop.fi.FiTestUtil.MarkerConstraint;
 import org.apache.hadoop.hdfs.protocol.DatanodeID;
-import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException;
 
@@ -55,7 +54,7 @@ public class DataTransferTestUtil {
    * and some actions.
    */
   public static class DataTransferTest implements PipelineTest {
-    private List<Pipeline> pipelines = new ArrayList<Pipeline>();
+    private final List<Pipeline> pipelines = new ArrayList<Pipeline>();
     private volatile boolean isSuccess = false;
 
     /** Simulate action for the receiverOpWriteBlock pointcut */
@@ -101,7 +100,8 @@ public class DataTransferTestUtil {
     }
 
     /** Initialize the pipeline. */
-    public Pipeline initPipeline(LocatedBlock lb) {
+    @Override
+    public synchronized Pipeline initPipeline(LocatedBlock lb) {
       final Pipeline pl = new Pipeline(lb);
       if (pipelines.contains(pl)) {
         throw new IllegalStateException("thepipeline != null");
@@ -110,20 +110,31 @@ public class DataTransferTestUtil {
       return pl;
     }
 
-    /** Return the pipeline. */
-    public Pipeline getPipeline(DatanodeID id) {
-      if (pipelines == null) {
-        throw new IllegalStateException("thepipeline == null");
-      }
-      StringBuilder dnString = new StringBuilder();
-      for (Pipeline pipeline : pipelines) {
-        for (DatanodeInfo dni : pipeline.getDataNodes())
-          dnString.append(dni.getStorageID());
-        if (dnString.toString().contains(id.getStorageID()))
-          return pipeline;
+    /** Return the pipeline for the datanode. */
+    @Override
+    public synchronized Pipeline getPipelineForDatanode(DatanodeID id) {
+      for (Pipeline p : pipelines) {
+        if (p.contains(id)){
+          return p;
+        }
       }
+      FiTestUtil.LOG.info("FI: pipeline not found; id=" + id
+          + ", pipelines=" + pipelines);
       return null;
     }
+
+    /**
+     * Is the test not yet success
+     * and the last pipeline contains the given datanode?
+     */
+    private synchronized boolean isNotSuccessAndLastPipelineContains(
+        int index, DatanodeID id) {
+      if (isSuccess()) {
+        return false;
+      }
+      final int n = pipelines.size();
+      return n == 0? false: pipelines.get(n-1).contains(index, id);
+    }
   }
 
   /** Action for DataNode */
@@ -171,8 +182,7 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID datanodeid) throws IOException {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(datanodeid);
-      if (p.contains(index, datanodeid)) {
+      if (test.isNotSuccessAndLastPipelineContains(index, datanodeid)) {
         marker.mark();
       }
     }
@@ -193,8 +203,7 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (!test.isSuccess() && p.contains(index, id)) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)) {
         final String s = toString(id);
         FiTestUtil.LOG.info(s);
         throw new OutOfMemoryError(s);
@@ -215,8 +224,8 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (p.contains(index, id) && countdown.isSatisfied()) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)
+          && countdown.isSatisfied()) {
         final String s = toString(id);
         FiTestUtil.LOG.info(s);
         throw new OutOfMemoryError(s);
@@ -234,8 +243,7 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) throws DiskOutOfSpaceException {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (p.contains(index, id)) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)) {
         final String s = toString(id);
         FiTestUtil.LOG.info(s);
         throw new DiskOutOfSpaceException(s);
@@ -256,8 +264,7 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) throws IOException {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (p.contains(index, id)) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)) {
         final String s = toString(id);
         FiTestUtil.LOG.info(s);
         throw new IOException(s);
@@ -284,8 +291,8 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) throws DiskOutOfSpaceException {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (p.contains(index, id) && countdown.isSatisfied()) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)
+          && countdown.isSatisfied()) {
         final String s = toString(id);
         FiTestUtil.LOG.info(s);
         throw new DiskOutOfSpaceException(s);
@@ -339,8 +346,7 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (!test.isSuccess() && p.contains(index, id)) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)) {
         FiTestUtil.LOG.info(toString(id));
         if (maxDuration <= 0) {
           for(; FiTestUtil.sleep(1000); ); //sleep forever until interrupt
@@ -385,8 +391,8 @@ public class DataTransferTestUtil {
     @Override
     public void run(DatanodeID id) {
       final DataTransferTest test = getDataTransferTest();
-      final Pipeline p = test.getPipeline(id);
-      if (p.contains(index, id) && countdown.isSatisfied()) {
+      if (test.isNotSuccessAndLastPipelineContains(index, id)
+          && countdown.isSatisfied()) {
         final String s = toString(id) + ", duration = ["
         + minDuration + "," + maxDuration + ")";
         FiTestUtil.LOG.info(s);

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/FiHFlushTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/FiHFlushTestUtil.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/FiHFlushTestUtil.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/FiHFlushTestUtil.java Thu May 12 23:34:50 2011
@@ -44,9 +44,8 @@ public class FiHFlushTestUtil extends Da
 
     /** {@inheritDoc} */
     public void run(DatanodeID id) throws IOException {
-      final Pipeline p = getPipelineTest().getPipeline(id);
+      final Pipeline p = getPipelineTest().getPipelineForDatanode(id);
       if (p == null) {
-        FiTestUtil.LOG.info("FI: couldn't find a pipeline for " + id);
         return;
       }
       if (p.contains(index, id)) {

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/Pipeline.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/Pipeline.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/Pipeline.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/Pipeline.java Thu May 12 23:34:50 2011
@@ -26,13 +26,16 @@ import java.util.ArrayList;
 
 public class Pipeline {
   private final List<String> datanodes = new ArrayList<String>();
-  private DatanodeInfo[] nodes;
 
   Pipeline(LocatedBlock lb) {
     for(DatanodeInfo d : lb.getLocations()) {
       datanodes.add(d.getName());
     }
-    nodes = lb.getLocations();
+  }
+
+  /** Does the pipeline contains d? */
+  public boolean contains(DatanodeID d) {
+    return datanodes.contains(d.getName());
   }
 
   /** Does the pipeline contains d at the n th position? */
@@ -40,12 +43,7 @@ public class Pipeline {
     return d.getName().equals(datanodes.get(n));
   }
 
-  /** Returns DatanodeInfo[] of the nodes of the constructed pipiline*/
-  public DatanodeInfo[] getDataNodes () {
-    return nodes;
-  }
-
-  /** {@inheritDoc} */
+  @Override
   public String toString() {
     return getClass().getSimpleName() + datanodes;
   }

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/PipelineTest.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/PipelineTest.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/PipelineTest.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/aop/org/apache/hadoop/fi/PipelineTest.java Thu May 12 23:34:50 2011
@@ -23,5 +23,5 @@ import org.apache.hadoop.hdfs.protocol.L
 /** A pipeline contains a list of datanodes. */
 public interface PipelineTest {
   public Pipeline initPipeline(LocatedBlock lb);
-  public Pipeline getPipeline(DatanodeID id);
+  public Pipeline getPipelineForDatanode(DatanodeID id);
 }

Propchange: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 23:34:50 2011
@@ -3,4 +3,4 @@
 /hadoop/hdfs/branches/HDFS-1052/src/test/hdfs:987665-1095512
 /hadoop/hdfs/branches/HDFS-265/src/test/hdfs:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/test/hdfs:820487
-/hadoop/hdfs/trunk/src/test/hdfs:1086482-1100841
+/hadoop/hdfs/trunk/src/test/hdfs:1086482-1102504

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/cli/testHDFSConf.xml
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/cli/testHDFSConf.xml?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/cli/testHDFSConf.xml (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/cli/testHDFSConf.xml Thu May 12 23:34:50 2011
@@ -189,7 +189,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access /file1: No such file or directory.</expected-output>
+          <expected-output>^ls: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -204,7 +204,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access /user: No such file or directory.</expected-output>
+          <expected-output>^ls: `/user': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -420,7 +420,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access hdfs:///file1: No such file or directory.</expected-output>
+          <expected-output>^ls: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -436,7 +436,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access hdfs://\w+[.a-z]*:[0-9]+/file1: No such file or directory.</expected-output>
+          <expected-output>^ls: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -718,7 +718,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^lsr: Cannot access /file1: No such file or directory.</expected-output>
+          <expected-output>^lsr: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -733,7 +733,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^lsr: Cannot access /user: No such file or directory.</expected-output>
+          <expected-output>^lsr: `/user': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -810,7 +810,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^lsr: Cannot access hdfs:///file1: No such file or directory.</expected-output>
+          <expected-output>^lsr: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -887,7 +887,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^lsr: Cannot access hdfs://\w+[.a-z]*:[0-9]+/file1: No such file or directory.</expected-output>
+          <expected-output>^lsr: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1647,7 +1647,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>ls: Cannot access /file1: No such file or directory.</expected-output>
+          <expected-output>ls: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1681,7 +1681,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>ls: Cannot access /file1: No such file or directory.</expected-output>
+          <expected-output>ls: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1730,7 +1730,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>ls: Cannot access /file*: No such file or directory.</expected-output>
+          <expected-output>ls: `/file*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1816,7 +1816,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>ls: Cannot access hdfs:///file*: No such file or directory.</expected-output>
+          <expected-output>ls: `hdfs:///file*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1831,7 +1831,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>mv: hdfs:/file1: No such file or directory</expected-output>
+          <expected-output>mv: `hdfs:/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1865,7 +1865,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>ls: Cannot access hdfs:///file1: No such file or directory.</expected-output>
+          <expected-output>ls: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1909,7 +1909,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>ls: Cannot access hdfs:///file*: No such file or directory.</expected-output>
+          <expected-output>ls: `hdfs:///file*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1969,7 +1969,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access hdfs:\/\/\w+[.a-z]*:[0-9]+\/file1: No such file or directory.</expected-output>
+          <expected-output>^ls: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -1984,7 +1984,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^mv: hdfs://\w+[.a-z]*:[0-9]+/file1: No such file or directory</expected-output>
+          <expected-output>^mv: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2018,7 +2018,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access hdfs:\/\/\w+[.a-z]*:[0-9]+\/file1: No such file or directory.</expected-output>
+          <expected-output>^ls: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2062,7 +2062,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^ls: Cannot access hdfs:\/\/\w+[.a-z]*:[0-9]+\/file\*: No such file or directory.</expected-output>
+          <expected-output>^ls: `hdfs://\w+[.a-z]*:[0-9]+/file\*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2361,7 +2361,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cp: File does not exist: /file</expected-output>
+          <expected-output>^cp: `/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2377,7 +2377,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cp: File does not exist: file1</expected-output>
+          <expected-output>^cp: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2626,7 +2626,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cp: File does not exist: hdfs:/file</expected-output>
+          <expected-output>^cp: `hdfs:/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2725,7 +2725,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cp: File does not exist: hdfs:/dir0</expected-output>
+          <expected-output>^cp: `hdfs:/dir0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2978,7 +2978,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cp: File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file</expected-output>
+          <expected-output>^cp: `hdfs://\w+[.a-z]*:[0-9]+/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3164,7 +3164,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir0/file0</expected-output>
+          <expected-output>^Deleted /dir0/file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3181,7 +3181,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+          <expected-output>^Deleted file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3262,7 +3262,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: Cannot remove directory "hdfs://\w+[.a-z]*:[0-9]*/dir0", use -rmr instead</expected-output>
+          <expected-output>^rm: `/dir0': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3279,7 +3279,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: cannot remove dir0: No such file or directory.</expected-output>
+          <expected-output>^rm: `dir0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3295,7 +3295,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: cannot remove /dir0/file0: No such file or directory.</expected-output>
+          <expected-output>^rm: `/dir0/file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3311,7 +3311,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: cannot remove file0: No such file or directory.</expected-output>
+          <expected-output>^rm: `file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3328,7 +3328,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/file0</expected-output>
+          <expected-output>^Deleted hdfs:///file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3377,7 +3377,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: Cannot remove directory "hdfs://\w+[.a-z]*:[0-9]*/dir0", use -rmr instead</expected-output>
+          <expected-output>^rm: `hdfs:///dir0': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3394,7 +3394,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: cannot remove hdfs:/file0: No such file or directory.</expected-output>
+          <expected-output>^rm: `hdfs:///file0': No such file or directory</expected-output>
         </comparator>
      </comparators>
     </test>
@@ -3414,19 +3414,19 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/file0</expected-output>
+          <expected-output>^Deleted hdfs:///file0</expected-output>
        </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/file1</expected-output>
+          <expected-output>^Deleted hdfs:///file1</expected-output>
        </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/file2</expected-output>
+          <expected-output>^Deleted hdfs:///file2</expected-output>
        </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/file3</expected-output>
+          <expected-output>^Deleted hdfs:///file3</expected-output>
        </comparator>
       </comparators>
     </test>
@@ -3492,7 +3492,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>rm: cannot remove hdfs://\w+[.a-z]*:[0-9]*/dir0: No such file or directory.</expected-output>
+          <expected-output>rm: `hdfs://\w+[.a-z]*:[0-9]*/dir0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3509,7 +3509,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rm: cannot remove hdfs://\w+[.a-z]*:[0-9]*/file0: No such file or directory.</expected-output>
+          <expected-output>^rm: `hdfs://\w+[.a-z]*:[0-9]*/file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3559,7 +3559,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir0/file0</expected-output>
+          <expected-output>^Deleted /dir0/file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3576,7 +3576,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+          <expected-output>^Deleted file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3593,7 +3593,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir0</expected-output>
+          <expected-output>^Deleted /dir0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3610,7 +3610,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/user/[a-z]*/dir0</expected-output>
+          <expected-output>^Deleted dir0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3690,7 +3690,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rmr: cannot remove /dir0/file0: No such file or directory.</expected-output>
+          <expected-output>^rmr: `/dir0/file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3706,7 +3706,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rmr: cannot remove file0: No such file or directory.</expected-output>
+          <expected-output>^rmr: `file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3723,7 +3723,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/file0</expected-output>
+          <expected-output>^Deleted hdfs:///file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3740,7 +3740,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir0</expected-output>
+          <expected-output>^Deleted hdfs:///dir0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3788,7 +3788,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rmr: cannot remove hdfs:/file0: No such file or directory.</expected-output>
+          <expected-output>^rmr: `hdfs:///file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3808,19 +3808,19 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir0</expected-output>
+          <expected-output>^Deleted hdfs:///dir0</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir1</expected-output>
+          <expected-output>^Deleted hdfs:///dir1</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir2</expected-output>
+          <expected-output>^Deleted hdfs:///dir2</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Deleted hdfs://\w+[.a-z]*:[0-9]*/dir3</expected-output>
+          <expected-output>^Deleted hdfs:///dir3</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -3902,7 +3902,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^rmr: cannot remove hdfs://\w+[.a-z]*:[0-9]*/file0: No such file or directory.</expected-output>
+          <expected-output>^rmr: `hdfs://\w+[.a-z]*:[0-9]*/file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4106,7 +4106,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>put: File /user/wrongdata does not exist</expected-output>
+          <expected-output>put: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4122,7 +4122,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>put: File wrongdata does not exist</expected-output>
+          <expected-output>put: `wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4193,7 +4193,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^put: `wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^put: `wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4285,7 +4285,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>put: File /user/wrongdata does not exist</expected-output>
+          <expected-output>put: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4335,7 +4335,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^put: `hdfs:/wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^put: `hdfs:/wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4427,7 +4427,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^put: File /user/wrongdata does not exist.</expected-output>
+          <expected-output>^put: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4477,7 +4477,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^put: `hdfs://\w+[.a-z]*:[0-9]+/wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^put: `hdfs://\w+[.a-z]*:[0-9]+/wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4646,7 +4646,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>copyFromLocal: File /user/wrongdata does not exist</expected-output>
+          <expected-output>copyFromLocal: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4662,7 +4662,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>copyFromLocal: File wrongdata does not exist</expected-output>
+          <expected-output>copyFromLocal: `wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4733,7 +4733,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^copyFromLocal: `wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^copyFromLocal: `wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4820,7 +4820,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>copyFromLocal: File /user/wrongdata does not exist</expected-output>
+          <expected-output>copyFromLocal: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4870,7 +4870,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^copyFromLocal: `hdfs:/wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^copyFromLocal: `hdfs:/wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -4958,7 +4958,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>copyFromLocal: File /user/wrongdata does not exist</expected-output>
+          <expected-output>copyFromLocal: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5008,7 +5008,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^copyFromLocal: `hdfs://\w+[.a-z]*:[0-9]+/wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^copyFromLocal: `hdfs://\w+[.a-z]*:[0-9]+/wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5025,7 +5025,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>get: .*: No such file or directory</expected-output>
+          <expected-output>get: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5041,7 +5041,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>get: .*: No such file or directory</expected-output>
+          <expected-output>get: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5057,7 +5057,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>get: .*: No such file or directory</expected-output>
+          <expected-output>get: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5073,7 +5073,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>get: .*: No such file or directory</expected-output>
+          <expected-output>get: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5211,7 +5211,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /file</expected-output>
+          <expected-output>^cat: `/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5226,7 +5226,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /user/[a-z]*/file</expected-output>
+          <expected-output>^cat: `file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5243,7 +5243,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /dir1</expected-output>
+          <expected-output>^cat: `/dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5252,7 +5252,7 @@
       <description>cat: contents of directory(relative path)</description>
       <test-commands>
         <command>-fs NAMENODE -mkdir dir1</command>
-        <command>-fs NAMENODE -cat dir</command>
+        <command>-fs NAMENODE -cat dir1</command>
       </test-commands>
       <cleanup-commands>
         <command>-fs NAMENODE -rmr dir1</command>
@@ -5260,7 +5260,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /user/[a-z]*/dir</expected-output>
+          <expected-output>^cat: `dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5334,7 +5334,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /file</expected-output>
+          <expected-output>^cat: `hdfs:///file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5351,7 +5351,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /dir1</expected-output>
+          <expected-output>^cat: `hdfs:///dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5426,7 +5426,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /file</expected-output>
+          <expected-output>^cat: `hdfs://\w+[.a-z]*:[0-9]*/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5443,7 +5443,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /dir1</expected-output>
+          <expected-output>^cat: `hdfs://\w+[.a-z]*:[0-9]*/dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5460,7 +5460,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>copyToLocal: .*: No such file or directory</expected-output>
+          <expected-output>copyToLocal: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5476,7 +5476,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>copyToLocal: .*: No such file or directory</expected-output>
+          <expected-output>copyToLocal: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5492,7 +5492,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>copyToLocal: .*: No such file or directory</expected-output>
+          <expected-output>copyToLocal: `.*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5508,7 +5508,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>copyToLocal: .*: No such file or directory</expected-output>
+          <expected-output>copyToLocal: `.*': No such file or directory</expected-output>
         </comparator>
      </comparators>
     </test>
@@ -5627,7 +5627,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>mkdir: cannot create directory /dir0: File exists</expected-output>
+          <expected-output>mkdir: `/dir0': File exists</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5644,7 +5644,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>mkdir: data15bytes exists but is not a directory</expected-output>
+          <expected-output>mkdir: `data15bytes': Is not a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5707,7 +5707,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>mkdir: cannot create directory hdfs:///dir0: File exists</expected-output>
+          <expected-output>mkdir: `hdfs:///dir0': File exists</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5724,7 +5724,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>mkdir: hdfs:///data15bytes exists but is not a directory</expected-output>
+          <expected-output>mkdir: `hdfs:///data15bytes': Is not a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5787,7 +5787,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>mkdir: cannot create directory hdfs://\w+[.a-z]*:[0-9]+/dir0: File exists</expected-output>
+          <expected-output>mkdir: `hdfs://\w+[.a-z]*:[0-9]+/dir0': File exists</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5804,7 +5804,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>mkdir: hdfs://\w+[.a-z]*:[0-9]+/data15bytes exists but is not a directory</expected-output>
+          <expected-output>mkdir: `hdfs://\w+[.a-z]*:[0-9]+/data15bytes': Is not a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5822,7 +5822,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/dir0/file0</expected-output>
+          <expected-output>^Replication 2 set: /dir0/file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5839,7 +5839,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+          <expected-output>^Replication 2 set: file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5857,11 +5857,11 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/dir0/file0</expected-output>
+          <expected-output>^Replication 2 set: /dir0/file0</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/dir0/file1</expected-output>
+          <expected-output>^Replication 2 set: /dir0/file1</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5879,11 +5879,11 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/user/[a-z]*/dir0/file0</expected-output>
+          <expected-output>^Replication 2 set: dir0/file0</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/user/[a-z]*/dir0/file1</expected-output>
+          <expected-output>^Replication 2 set: dir0/file1</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5899,7 +5899,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^setrep: File does not exist: /dir0/file</expected-output>
+          <expected-output>^setrep: `/dir0/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5915,7 +5915,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^setrep: File does not exist: file0</expected-output>
+          <expected-output>^setrep: `file0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5932,7 +5932,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/dir0/file0</expected-output>
+          <expected-output>^Replication 2 set: hdfs:///dir0/file0</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5950,11 +5950,11 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/dir0/file0</expected-output>
+          <expected-output>^Replication 2 set: hdfs:///dir0/file0</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^Replication 2 set: hdfs://\w+[.a-z]*:[0-9]*/dir0/file1</expected-output>
+          <expected-output>^Replication 2 set: hdfs:///dir0/file1</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5970,7 +5970,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^setrep: File does not exist: hdfs:/dir0/file</expected-output>
+          <expected-output>^setrep: `hdfs:///dir0/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6025,7 +6025,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^setrep: File does not exist: hdfs://\w+[.a-z]*:[0-9]+/dir0/file</expected-output>
+          <expected-output>^setrep: `hdfs://\w+[.a-z]*:[0-9]+/dir0/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6247,7 +6247,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: /dir0/file</expected-output>
+          <expected-output>^test: `/dir0/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6263,7 +6263,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: file</expected-output>
+          <expected-output>^test: `file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6279,7 +6279,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: /dir</expected-output>
+          <expected-output>^test: `/dir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6295,7 +6295,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: dir0</expected-output>
+          <expected-output>^test: `dir0': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6311,7 +6311,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: hdfs:/dir0/file</expected-output>
+          <expected-output>^test: `hdfs:///dir0/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6327,7 +6327,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: hdfs:/dir</expected-output>
+          <expected-output>^test: `hdfs:///dir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6343,7 +6343,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: hdfs://\w+[.a-z]*:[0-9]+/dir0/file</expected-output>
+          <expected-output>^test: `hdfs://\w+[.a-z]*:[0-9]+/dir0/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6359,7 +6359,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^test: File does not exist: hdfs://\w+[.a-z]*:[0-9]+/dir</expected-output>
+          <expected-output>^test: `hdfs://\w+[.a-z]*:[0-9]+/dir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6518,7 +6518,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^stat: cannot stat `/file': No such file or directory</expected-output>
+          <expected-output>^stat: `/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6533,7 +6533,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^stat: cannot stat `file1': No such file or directory</expected-output>
+          <expected-output>^stat: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6620,7 +6620,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^stat: cannot stat `hdfs:///file': No such file or directory</expected-output>
+          <expected-output>^stat: `hdfs:///file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6707,7 +6707,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^stat: cannot stat `hdfs://\w+[.a-z]*:[0-9]+/file': No such file or directory</expected-output>
+          <expected-output>^stat: `hdfs://\w+[.a-z]*:[0-9]+/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6762,7 +6762,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: /file\*</expected-output>
+          <expected-output>^tail: `/file\*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6782,7 +6782,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: file\*</expected-output>
+          <expected-output>^tail: `file\*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6797,7 +6797,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: /file</expected-output>
+          <expected-output>^tail: `/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6812,7 +6812,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: file1</expected-output>
+          <expected-output>^tail: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6829,7 +6829,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: Source must be a file.</expected-output>
+          <expected-output>^tail: `/dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6846,7 +6846,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: Source must be a file.</expected-output>
+          <expected-output>^tail: `dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6883,7 +6883,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: hdfs:/file\*</expected-output>
+          <expected-output>^tail: `hdfs:///file\*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6898,7 +6898,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: hdfs:/file</expected-output>
+          <expected-output>^tail: `hdfs:///file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6915,7 +6915,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: Source must be a file.</expected-output>
+          <expected-output>^tail: `hdfs:///dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6952,7 +6952,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file\*</expected-output>
+          <expected-output>^tail: `hdfs://\w+[.a-z]*:[0-9]+/file\*': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6967,7 +6967,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file</expected-output>
+          <expected-output>^tail: `hdfs://\w+[.a-z]*:[0-9]+/file': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -6984,7 +6984,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^tail: Source must be a file.</expected-output>
+          <expected-output>^tail: `hdfs://\w+[.a-z]*:[0-9]+/dir1': Is a directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -7068,7 +7068,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>count: Can not find listing for /file1</expected-output>
+          <expected-output>count: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -7083,7 +7083,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>count: Can not find listing for file1</expected-output>
+          <expected-output>count: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -7426,7 +7426,7 @@
       <comparators>
         <comparator>
          <type>TokenComparator</type>
-          <expected-output>count: Can not find listing for /file1</expected-output>
+          <expected-output>count: `/file1': No such file or directory</expected-output>
        </comparator>
      </comparators>
    </test>
@@ -7441,7 +7441,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>count: Can not find listing for file1</expected-output>
+          <expected-output>count: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -7778,7 +7778,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>count: Can not find listing for hdfs:/file1</expected-output>
+          <expected-output>count: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -7957,7 +7957,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>count: Can not find listing for hdfs:/file1</expected-output>
+          <expected-output>count: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -8150,7 +8150,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>count: Can not find listing for hdfs://\w+[.a-z]*:[0-9]+/file1</expected-output>
+          <expected-output>count: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -8329,7 +8329,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>count: Can not find listing for hdfs://\w+[.a-z]*:[0-9]+/file1</expected-output>
+          <expected-output>count: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -8850,7 +8850,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for '/file1': File does not exist: /file1</expected-output>
+          <expected-output>^chmod: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -8866,7 +8866,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for 'file1': File does not exist: file1</expected-output>
+          <expected-output>^chmod: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -8882,7 +8882,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for '/file1': File does not exist: /file1</expected-output>
+          <expected-output>^chmod: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -8898,7 +8898,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for 'file1': File does not exist: file1</expected-output>
+          <expected-output>^chmod: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -10306,7 +10306,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for 'hdfs:/file1': File does not exist: hdfs:/file1</expected-output>
+          <expected-output>^chmod: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -10322,7 +10322,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for 'hdfs:/file1': File does not exist: hdfs:/file1</expected-output>
+          <expected-output>^chmod: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -11125,7 +11125,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for 'hdfs://\w+[.a-z]*:[0-9]+/file1': File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file1</expected-output>
+          <expected-output>^chmod: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -11141,7 +11141,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chmod: could not get status for 'hdfs://\w+[.a-z]*:[0-9]+/file1': File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file1</expected-output>
+          <expected-output>^chmod: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -11854,7 +11854,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chown: could not get status for 'hdfs:/file1': File does not exist: hdfs:/file1</expected-output>
+          <expected-output>^chown: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -12371,7 +12371,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chown: could not get status for '/file1': File does not exist: /file1</expected-output>
+          <expected-output>^chown: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -12387,7 +12387,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chown: could not get status for 'file1': File does not exist: file1</expected-output>
+          <expected-output>^chown: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -13133,7 +13133,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chown: could not get status for 'hdfs://\w+[.a-z]*:[0-9]+/file1': File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file1</expected-output>
+          <expected-output>^chown: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -13650,7 +13650,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chgrp: could not get status for '/file1': File does not exist: /file1</expected-output>
+          <expected-output>^chgrp: `/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -13666,7 +13666,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chgrp: could not get status for 'file1': File does not exist: file1</expected-output>
+          <expected-output>^chgrp: `file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -14378,7 +14378,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chgrp: could not get status for 'hdfs:/file1': File does not exist: hdfs:/file1</expected-output>
+          <expected-output>^chgrp: `hdfs:///file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -14788,7 +14788,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^chgrp: could not get status for 'hdfs://\w+[.a-z]*:[0-9]+/file1': File does not exist: hdfs://\w+[.a-z]*:[0-9]+/file1</expected-output>
+          <expected-output>^chgrp: `hdfs://\w+[.a-z]*:[0-9]+/file1': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16014,7 +16014,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>moveFromLocal: File /user/wrongdata does not exist</expected-output>
+          <expected-output>moveFromLocal: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16030,7 +16030,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>moveFromLocal: File wrongdata does not exist</expected-output>
+          <expected-output>moveFromLocal: `wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16067,7 +16067,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^moveFromLocal: `wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^moveFromLocal: `wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16083,7 +16083,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>moveFromLocal: File /user/wrongdata does not exist</expected-output>
+          <expected-output>moveFromLocal: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16116,7 +16116,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^moveFromLocal: `hdfs:/wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^moveFromLocal: `hdfs:/wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16132,7 +16132,7 @@
       <comparators>
         <comparator>
           <type>TokenComparator</type>
-          <expected-output>moveFromLocal: File /user/wrongdata does not exist</expected-output>
+          <expected-output>moveFromLocal: `/user/wrongdata': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -16165,7 +16165,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^moveFromLocal: `hdfs://\w+[.a-z]*:[0-9]+/wrongdir': specified destination directory doest not exist</expected-output>
+          <expected-output>^moveFromLocal: `hdfs://\w+[.a-z]*:[0-9]+/wrongdir': No such file or directory</expected-output>
         </comparator>
       </comparators>
     </test>

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java Thu May 12 23:34:50 2011
@@ -321,7 +321,7 @@ public class TestDFSShell extends TestCa
       argv[0] = "-cat";
       argv[1] = root.toUri().getPath();
       int ret = ToolRunner.run(new FsShell(), argv);
-      assertTrue(" -cat returned -1 ", 0>=ret);
+      assertEquals(" -cat returned 1 ", 1, ret);
       String returned = out.toString();
       assertTrue("cat does not print exceptions ",
           (returned.lastIndexOf("Exception") == -1));
@@ -331,7 +331,7 @@ public class TestDFSShell extends TestCa
       FsShell shell = new FsShell();
       shell.setConf(conf);
       ret = ToolRunner.run(shell, argv);
-      assertTrue(" -rm returned -1 ", 0>=ret);
+      assertEquals(" -rm returned 1 ", 1, ret);
       returned = out.toString();
       out.reset();
       assertTrue("rm prints reasonable error ",
@@ -339,7 +339,7 @@ public class TestDFSShell extends TestCa
       argv[0] = "-rmr";
       argv[1] = root.toString();
       ret = ToolRunner.run(shell, argv);
-      assertTrue(" -rmr returned -1", 0>=ret);
+      assertEquals(" -rmr returned 1", 1, ret);
       returned = out.toString();
       assertTrue("rmr prints reasonable error ",
     		  (returned.lastIndexOf("No such file or directory") != -1));
@@ -389,7 +389,7 @@ public class TestDFSShell extends TestCa
       argv[1] = "/testdir";
       ret = ToolRunner.run(shell, argv);
       returned = out.toString();
-      assertTrue(" -mkdir returned -1 ", (ret < 0));
+      assertEquals(" -mkdir returned 1 ", 1, ret);
       assertTrue(" -mkdir returned File exists", 
           (returned.lastIndexOf("File exists") != -1));
       Path testFile = new Path("/testfile");
@@ -401,7 +401,7 @@ public class TestDFSShell extends TestCa
       argv[1] = "/testfile";
       ret = ToolRunner.run(shell, argv);
       returned = out.toString();
-      assertTrue(" -mkdir returned -1", (ret < 0));
+      assertEquals(" -mkdir returned 1", 1, ret);
       assertTrue(" -mkdir returned this is a file ",
           (returned.lastIndexOf("not a directory") != -1));
       out.reset();

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgrade.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgrade.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgrade.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgrade.java Thu May 12 23:34:50 2011
@@ -33,6 +33,7 @@ import org.apache.hadoop.hdfs.protocol.F
 import org.apache.hadoop.hdfs.server.common.Storage;
 import org.apache.hadoop.hdfs.server.common.StorageInfo;
 import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption;
+import org.apache.hadoop.hdfs.server.namenode.TestParallelImageWrite;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
@@ -163,6 +164,8 @@ public class TestDFSUpgrade {
       UpgradeUtilities.createNameNodeStorageDirs(nameNodeDirs, "current");
       cluster = createCluster();
       checkNameNode(nameNodeDirs);
+      if (numDirs > 1)
+        TestParallelImageWrite.checkImages(cluster.getNamesystem(), numDirs);
       cluster.shutdown();
       UpgradeUtilities.createEmptyDirs(nameNodeDirs);
       
@@ -278,6 +281,23 @@ public class TestDFSUpgrade {
       startNameNodeShouldFail(StartupOption.UPGRADE);
       UpgradeUtilities.createEmptyDirs(nameNodeDirs);
     } // end numDir loop
+    
+    // One more check: normal NN upgrade with 4 directories, concurrent write
+    int numDirs = 4;
+    {
+      conf = new HdfsConfiguration();
+      conf.setInt(DFSConfigKeys.DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, -1);      
+      conf = UpgradeUtilities.initializeStorageStateConf(numDirs, conf);
+      String[] nameNodeDirs = conf.getStrings(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY);
+      
+      log("Normal NameNode upgrade", numDirs);
+      UpgradeUtilities.createNameNodeStorageDirs(nameNodeDirs, "current");
+      cluster = createCluster();
+      checkNameNode(nameNodeDirs);
+      TestParallelImageWrite.checkImages(cluster.getNamesystem(), numDirs);
+      cluster.shutdown();
+      UpgradeUtilities.createEmptyDirs(nameNodeDirs);
+    }
   }
  
   @Test(expected=IOException.class)

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDistributedFileSystem.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDistributedFileSystem.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestDistributedFileSystem.java Thu May 12 23:34:50 2011
@@ -100,6 +100,45 @@ public class TestDistributedFileSystem {
       if (cluster != null) {cluster.shutdown();}
     }
   }
+  
+  @Test
+  public void testDFSSeekExceptions() throws IOException {
+    Configuration conf = getTestConfiguration();
+    MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
+    FileSystem fileSys = cluster.getFileSystem();
+
+    try {
+      String file = "/test/fileclosethenseek/file-0";
+      Path path = new Path(file);
+      // create file
+      FSDataOutputStream output = fileSys.create(path);
+      output.writeBytes("Some test data to write longer than 10 bytes");
+      output.close();
+      FSDataInputStream input = fileSys.open(path);
+      input.seek(10);
+      boolean threw = false;
+      try {
+        input.seek(100);
+      } catch (IOException e) {
+        // success
+        threw = true;
+      }
+      assertTrue("Failed to throw IOE when seeking past end", threw);
+      input.close();
+      threw = false;
+      try {
+        input.seek(1);
+      } catch (IOException e) {
+        //success
+        threw = true;
+      }
+      assertTrue("Failed to throw IOE when seeking after close", threw);
+      fileSys.close();
+    }
+    finally {
+      if (cluster != null) {cluster.shutdown();}
+    }
+  }
 
   @Test
   public void testDFSClient() throws Exception {

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestLease.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestLease.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestLease.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestLease.java Thu May 12 23:34:50 2011
@@ -17,25 +17,32 @@
  */
 package org.apache.hadoop.hdfs;
 
-import java.io.*;
+import java.io.DataOutputStream;
+import java.security.PrivilegedExceptionAction;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hdfs.protocol.ClientProtocol;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
 
-public class TestLease extends junit.framework.TestCase {
+public class TestLease {
   static boolean hasLease(MiniDFSCluster cluster, Path src) {
     return cluster.getNamesystem().leaseManager.getLeaseByPath(src.toString()) != null;
   }
   
   final Path dir = new Path("/test/lease/");
 
+  @Test
   public void testLease() throws Exception {
     Configuration conf = new HdfsConfiguration();
     MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
     try {
       FileSystem fs = cluster.getFileSystem();
-      assertTrue(fs.mkdirs(dir));
+      Assert.assertTrue(fs.mkdirs(dir));
       
       Path a = new Path(dir, "a");
       Path b = new Path(dir, "b");
@@ -43,24 +50,56 @@ public class TestLease extends junit.fra
       DataOutputStream a_out = fs.create(a);
       a_out.writeBytes("something");
 
-      assertTrue(hasLease(cluster, a));
-      assertTrue(!hasLease(cluster, b));
+      Assert.assertTrue(hasLease(cluster, a));
+      Assert.assertTrue(!hasLease(cluster, b));
       
       DataOutputStream b_out = fs.create(b);
       b_out.writeBytes("something");
 
-      assertTrue(hasLease(cluster, a));
-      assertTrue(hasLease(cluster, b));
+      Assert.assertTrue(hasLease(cluster, a));
+      Assert.assertTrue(hasLease(cluster, b));
 
       a_out.close();
       b_out.close();
 
-      assertTrue(!hasLease(cluster, a));
-      assertTrue(!hasLease(cluster, b));
+      Assert.assertTrue(!hasLease(cluster, a));
+      Assert.assertTrue(!hasLease(cluster, b));
       
       fs.delete(dir, true);
     } finally {
       if (cluster != null) {cluster.shutdown();}
     }
   }
+
+  @Test
+  public void testFactory() throws Exception {
+    final String[] groups = new String[]{"supergroup"};
+    final UserGroupInformation[] ugi = new UserGroupInformation[3];
+    for(int i = 0; i < ugi.length; i++) {
+      ugi[i] = UserGroupInformation.createUserForTesting("user" + i, groups);
+    }
+
+    final Configuration conf = new Configuration();
+    final DFSClient c1 = createDFSClientAs(ugi[0], conf);
+    final DFSClient c2 = createDFSClientAs(ugi[0], conf);
+    Assert.assertEquals(c1.leaserenewer, c2.leaserenewer);
+    final DFSClient c3 = createDFSClientAs(ugi[1], conf);
+    Assert.assertTrue(c1.leaserenewer != c3.leaserenewer);
+    final DFSClient c4 = createDFSClientAs(ugi[1], conf);
+    Assert.assertEquals(c3.leaserenewer, c4.leaserenewer);
+    final DFSClient c5 = createDFSClientAs(ugi[2], conf);
+    Assert.assertTrue(c1.leaserenewer != c5.leaserenewer);
+    Assert.assertTrue(c3.leaserenewer != c5.leaserenewer);
+  }
+  
+  static final ClientProtocol mcp = Mockito.mock(ClientProtocol.class);
+  static public DFSClient createDFSClientAs(UserGroupInformation ugi, 
+      final Configuration conf) throws Exception {
+    return ugi.doAs(new PrivilegedExceptionAction<DFSClient>() {
+      @Override
+      public DFSClient run() throws Exception {
+        return new DFSClient(null, mcp, conf, null);
+      }
+    });
+  }
 }

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java Thu May 12 23:34:50 2011
@@ -19,6 +19,7 @@ package org.apache.hadoop.hdfs;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.security.PrivilegedExceptionAction;
 
 import org.apache.commons.logging.impl.Log4JLogger;
 import org.apache.hadoop.conf.Configuration;
@@ -58,7 +59,8 @@ public class TestReadWhileWriting {
     conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1);
 
     // create cluster
-    final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build();
+    final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
+        .numDataNodes(4).build();
     try {
       //change the lease limits.
       cluster.setLeasePeriod(SOFT_LEASE_LIMIT, HARD_LEASE_LIMIT);
@@ -93,7 +95,16 @@ public class TestReadWhileWriting {
         //sleep to let the lease is expired.
         Thread.sleep(2*SOFT_LEASE_LIMIT);
   
-        final DistributedFileSystem dfs = (DistributedFileSystem)FileSystem.newInstance(conf);
+        final UserGroupInformation current = UserGroupInformation.getCurrentUser();
+        final UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
+            current.getShortUserName() + "x", new String[]{"supergroup"});
+        final DistributedFileSystem dfs = ugi.doAs(
+            new PrivilegedExceptionAction<DistributedFileSystem>() {
+          @Override
+          public DistributedFileSystem run() throws Exception {
+            return (DistributedFileSystem)FileSystem.newInstance(conf);
+          }
+        });
         final FSDataOutputStream out = append(dfs, p);
         write(out, 0, half);
         out.close();

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java Thu May 12 23:34:50 2011
@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
+import java.util.concurrent.TimeoutException;
 
 import junit.framework.TestCase;
 
@@ -82,7 +83,7 @@ public class TestBlockReplacement extend
     assertTrue(totalBytes*1000/(end-start)<=bandwidthPerSec);
   }
   
-  public void testBlockReplacement() throws IOException {
+  public void testBlockReplacement() throws IOException, TimeoutException {
     final Configuration CONF = new HdfsConfiguration();
     final String[] INITIAL_RACKS = {"/RACK0", "/RACK1", "/RACK2"};
     final String[] NEW_RACKS = {"/RACK2"};
@@ -120,7 +121,7 @@ public class TestBlockReplacement extend
       assertEquals(oldNodes.length, 3);
       ExtendedBlock b = block.getBlock();
       
-      // add a new datanode to the cluster
+      // add a fourth datanode to the cluster
       cluster.startDataNodes(CONF, 1, true, null, NEW_RACKS);
       cluster.waitActive();
       
@@ -154,6 +155,9 @@ public class TestBlockReplacement extend
           }
         }
       }
+      //current state: the newNode is on RACK2, and "source" is the other dn on RACK2.
+      //the two datanodes on RACK0 and RACK1 are in "proxies".
+      //"source" and both "proxies" all contain the block, while newNode doesn't yet.
       assertTrue(source!=null && proxies.size()==2);
       
       // start to replace the block
@@ -161,24 +165,27 @@ public class TestBlockReplacement extend
       LOG.info("Testcase 1: Proxy " + newNode.getName() 
            + " does not contain the block " + b);
       assertFalse(replaceBlock(b, source, newNode, proxies.get(0)));
-      // case 2: destination contains the block
+      // case 2: destination already contains the block
       LOG.info("Testcase 2: Destination " + proxies.get(1).getName() 
           + " contains the block " + b);
       assertFalse(replaceBlock(b, source, proxies.get(0), proxies.get(1)));
       // case 3: correct case
-      LOG.info("Testcase 3: Proxy=" + source.getName() + " source=" + 
-          proxies.get(0).getName() + " destination=" + newNode.getName() );
+      LOG.info("Testcase 3: Source=" + source.getName() + " Proxy=" + 
+          proxies.get(0).getName() + " Destination=" + newNode.getName() );
       assertTrue(replaceBlock(b, source, proxies.get(0), newNode));
+      // after cluster has time to resolve the over-replication,
       // block locations should contain two proxies and newNode
+      // but not source
       checkBlocks(new DatanodeInfo[]{newNode, proxies.get(0), proxies.get(1)},
           fileName.toString(), 
           DEFAULT_BLOCK_SIZE, REPLICATION_FACTOR, client);
       // case 4: proxies.get(0) is not a valid del hint
+      // expect either source or newNode replica to be deleted instead
       LOG.info("Testcase 4: invalid del hint " + proxies.get(0).getName() );
-      assertTrue(replaceBlock(b, proxies.get(1), proxies.get(0), source));
-      /* block locations should contain two proxies,
-       * and either of source or newNode
-       */
+      assertTrue(replaceBlock(b, proxies.get(0), proxies.get(1), source));
+      // after cluster has time to resolve the over-replication,
+      // block locations should contain two proxies,
+      // and either source or newNode, but not both.
       checkBlocks(proxies.toArray(new DatanodeInfo[proxies.size()]), 
           fileName.toString(), 
           DEFAULT_BLOCK_SIZE, REPLICATION_FACTOR, client);
@@ -187,10 +194,16 @@ public class TestBlockReplacement extend
     }
   }
   
-  /* check if file's blocks exist at includeNodes */
+  /* check if file's blocks have expected number of replicas,
+   * and exist at all of includeNodes
+   */
   private void checkBlocks(DatanodeInfo[] includeNodes, String fileName, 
-      long fileLen, short replFactor, DFSClient client) throws IOException {
-    Boolean notDone;
+      long fileLen, short replFactor, DFSClient client) 
+      throws IOException, TimeoutException {
+    boolean notDone;
+    final long TIMEOUT = 20000L;
+    long starttime = System.currentTimeMillis();
+    long failtime = starttime + TIMEOUT;
     do {
       try {
         Thread.sleep(100);
@@ -214,7 +227,22 @@ public class TestBlockReplacement extend
           }
         }
       }
+      if (System.currentTimeMillis() > failtime) {
+        String expectedNodesList = "";
+        String currentNodesList = "";
+        for (DatanodeInfo dn : includeNodes) 
+          expectedNodesList += dn.getName() + ", ";
+        for (DatanodeInfo dn : nodes) 
+          currentNodesList += dn.getName() + ", ";
+        LOG.info("Expected replica nodes are: " + expectedNodesList);
+        LOG.info("Current actual replica nodes are: " + currentNodesList);
+        throw new TimeoutException(
+            "Did not achieve expected replication to expected nodes "
+            + "after more than " + TIMEOUT + " msec.  See logs for details.");
+      }
     } while(notDone);
+    LOG.info("Achieved expected replication values in "
+        + (System.currentTimeMillis() - starttime) + " msec.");
   }
 
   /* Copy a block from sourceProxy to destination. If the block becomes

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java Thu May 12 23:34:50 2011
@@ -684,6 +684,7 @@ public class TestCheckpoint extends Test
     cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes).format(false).build();
     cluster.waitActive();
     fileSys = cluster.getFileSystem();
+    Path tmpDir = new Path("/tmp_tmp");
     try {
       // check that file1 still exists
       checkFile(fileSys, file1, replication);
@@ -698,6 +699,11 @@ public class TestCheckpoint extends Test
       //
       SecondaryNameNode secondary = startSecondaryNameNode(conf);
       secondary.doCheckpoint();
+      
+      fileSys.delete(tmpDir, true);
+      fileSys.mkdirs(tmpDir);
+      secondary.doCheckpoint();
+      
       secondary.shutdown();
     } finally {
       fileSys.close();
@@ -713,6 +719,7 @@ public class TestCheckpoint extends Test
     fileSys = cluster.getFileSystem();
 
     assertTrue(!fileSys.exists(file1));
+    assertTrue(fileSys.exists(tmpDir));
 
     try {
       // verify that file2 exists

Modified: hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java?rev=1102509&r1=1102508&r2=1102509&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java (original)
+++ hadoop/hdfs/branches/HDFS-1073/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java Thu May 12 23:34:50 2011
@@ -405,8 +405,10 @@ public class TestEditLog extends TestCas
     try {
       cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATA_NODES).format(false).build();
       fail("should not be able to start");
-    } catch (ChecksumException e) {
+    } catch (IOException e) {
       // expected
+      assertEquals("Cause of exception should be ChecksumException",
+          e.getCause().getClass(), ChecksumException.class);
     }
   }
 



Mime
View raw message