Browse Source

HDFS-14723. Add helper method FSNamesystem#setBlockManagerForTesting() in branch-2. Contributed by Wei-Chiu Chuang.

Reviewed-by: Chao Sun <sunchao@apache.org>
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Reviewed-by: Erik Krogen <xkrogen@apache.org>
Wei-Chiu Chuang 5 years ago
parent
commit
f27d040ce3

+ 6 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

@@ -425,7 +425,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
 
 
   /** The namespace tree. */
   /** The namespace tree. */
   FSDirectory dir;
   FSDirectory dir;
-  private final BlockManager blockManager;
+  private BlockManager blockManager;
   private final SnapshotManager snapshotManager;
   private final SnapshotManager snapshotManager;
   private final CacheManager cacheManager;
   private final CacheManager cacheManager;
   private final DatanodeStatistics datanodeStatistics;
   private final DatanodeStatistics datanodeStatistics;
@@ -5808,6 +5808,11 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     return blockManager;
     return blockManager;
   }
   }
 
 
+  @VisibleForTesting
+  public void setBlockManagerForTesting(BlockManager bm) {
+    this.blockManager = bm;
+  }
+
   /** @return the FSDirectory. */
   /** @return the FSDirectory. */
   @Override
   @Override
   public FSDirectory getFSDirectory() {
   public FSDirectory getFSDirectory() {