ArrayList<File> dirs = new ArrayList<File>();
File dataDir = new File(DATA_DIR);
FileUtil.fullyDelete(dataDir);
dataDir.mkdirs();
dirs.add(dataDir);
DatanodeProtocol namenode = mock(DatanodeProtocol.class);
when(namenode.versionRequest()).thenReturn(new NamespaceInfo
(1, CLUSTER_ID, POOL_ID, 1L, 1));
when(namenode.sendHeartbeat(any(DatanodeRegistration.class), anyLong(),
anyLong(), anyLong(), anyLong(), anyInt(), anyInt(), anyInt()))
.thenReturn(new DatanodeCommand[0]);
dn = new DataNode(conf, dirs, null);
DataNodeTestUtils.setBPNamenodeByIndex(dn, nsifno, POOL_ID, namenode);