Modified: 
hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java?rev=1166495&r1=1166494&r2=1166495&view=diff
==============================================================================
--- 
hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
 (original)
+++ 
hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java
 Thu Sep  8 01:39:07 2011
@@ -31,7 +31,7 @@ import org.apache.hadoop.hdfs.protocol.D
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
 import org.apache.hadoop.hdfs.protocol.RecoveryInProgressException;
-import org.apache.hadoop.hdfs.server.common.HdfsConstants.ReplicaState;
+import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.ReplicaState;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord;
 import 
org.apache.hadoop.hdfs.server.datanode.FSDatasetInterface.BlockWriteStreams;

Modified: 
hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java?rev=1166495&r1=1166494&r2=1166495&view=diff
==============================================================================
--- 
hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java
 (original)
+++ 
hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java
 Thu Sep  8 01:39:07 2011
@@ -47,8 +47,8 @@ import org.apache.hadoop.hdfs.protocol.D
 import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
 import 
org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoUnderConstruction;
 import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
-import org.apache.hadoop.hdfs.server.common.HdfsConstants;
-import org.apache.hadoop.hdfs.server.common.HdfsConstants.NamenodeRole;
+import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
+import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.log4j.Level;
 import org.junit.After;
@@ -84,7 +84,7 @@ public class TestNNLeaseRecovery {
     FileSystem.setDefaultUri(conf, "hdfs://localhost:0");
     conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "0.0.0.0:0");
     DFSTestUtil.formatNameNode(conf);
-    fsn = spy(new FSNamesystem(conf));
+    fsn = spy(FSNamesystem.loadFromDisk(conf));
   }
 
   /**
@@ -159,7 +159,7 @@ public class TestNNLeaseRecovery {
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
     mockFileBlocks(2, null, 
-      HdfsConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, false);
+      HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, 
false);
     
     releaseLease(fsn, lm, file);
     fail("FSNamesystem.internalReleaseLease suppose to throw " +
@@ -184,8 +184,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
 
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.COMMITTED, file, dnd, ps, false);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.COMMITTED, file, dnd, ps, false);
 
     releaseLease(fsn, lm, file);
     fail("FSNamesystem.internalReleaseLease suppose to throw " +
@@ -232,7 +232,7 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
 
-    mockFileBlocks(1, null, HdfsConstants.BlockUCState.COMMITTED, file, dnd, 
ps, false);
+    mockFileBlocks(1, null, HdfsServerConstants.BlockUCState.COMMITTED, file, 
dnd, ps, false);
 
     releaseLease(fsn, lm, file);
     fail("FSNamesystem.internalReleaseLease suppose to throw " +
@@ -257,8 +257,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, false);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, 
false);
         
     assertFalse("False is expected in return in this case",
         releaseLease(fsn, lm, file));
@@ -278,8 +278,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, false);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, 
false);
     
     BlockInfo lastBlock = fsn.dir.getFileINode(anyString()).getLastBlock(); 
     try {
@@ -304,8 +304,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.COMPLETE, file, dnd, ps, true);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.COMPLETE, file, dnd, ps, true);
     
     BlockInfo lastBlock = fsn.dir.getFileINode(anyString()).getLastBlock();
     when(lastBlock.isComplete()).thenReturn(true);
@@ -332,8 +332,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, true);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, 
true);
     
     BlockInfo lastBlock = fsn.dir.getFileINode(anyString()).getLastBlock();
     
when(((BlockInfoUnderConstruction)lastBlock).getBlockRecoveryId()).thenReturn(recoveryId-100);
@@ -360,8 +360,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, true);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, 
true);
     
     BlockInfo lastBlock = fsn.dir.getFileINode(anyString()).getLastBlock();
     
when(((BlockInfoUnderConstruction)lastBlock).getBlockRecoveryId()).thenReturn(recoveryId+100);
@@ -388,8 +388,8 @@ public class TestNNLeaseRecovery {
     PermissionStatus ps =
       new PermissionStatus("test", "test", new FsPermission((short)0777));
     
-    mockFileBlocks(2, HdfsConstants.BlockUCState.COMMITTED, 
-      HdfsConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, true);
+    mockFileBlocks(2, HdfsServerConstants.BlockUCState.COMMITTED, 
+      HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, file, dnd, ps, 
true);
     
     BlockInfo lastBlock = fsn.dir.getFileINode(anyString()).getLastBlock();
     
when(((BlockInfoUnderConstruction)lastBlock).getBlockRecoveryId()).thenReturn(recoveryId);
@@ -407,8 +407,8 @@ public class TestNNLeaseRecovery {
   }
 
   private void mockFileBlocks(int fileBlocksNumber,
-                              HdfsConstants.BlockUCState penUltState,
-                              HdfsConstants.BlockUCState lastState,
+                              HdfsServerConstants.BlockUCState penUltState,
+                              HdfsServerConstants.BlockUCState lastState,
                               Path file, DatanodeDescriptor dnd,
                               PermissionStatus ps,
                               boolean setStoredBlock) throws IOException {
@@ -428,7 +428,6 @@ public class TestNNLeaseRecovery {
                             
     when(fsn.getFSImage()).thenReturn(fsImage);
     when(fsn.getFSImage().getEditLog()).thenReturn(editLog);
-    fsn.getFSImage().setFSNamesystem(fsn);
     
     switch (fileBlocksNumber) {
       case 0:


Reply via email to