@Test(timeout = 300000)
public void testMoverWhenStoragePolicyUnset() throws Exception {

  final Configuration conf = new HdfsConfiguration();
  initConf(conf);
  final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
      .numDataNodes(1)
      .storageTypes(
          new StorageType[][] {{StorageType.DISK, StorageType.ARCHIVE}})
      .build();
  try {
    cluster.waitActive();
    final DistributedFileSystem dfs = cluster.getFileSystem();
    final String file = "/testMoverWhenStoragePolicyUnset";
    // write to DISK
    DFSTestUtil.createFile(dfs, new Path(file), 1L, (short) 1, 0L);
    // move to ARCHIVE
    dfs.setStoragePolicy(new Path(file), "COLD");
    int rc = ToolRunner.run(conf, new Mover.Cli(),
        new String[] {"-p", file.toString()});
    Assert.assertEquals("Movement to ARCHIVE should be successful", 0, rc);
    // Wait till namenode notified about the block location details
    waitForLocatedBlockWithArchiveStorageType(dfs, file, 1);
    // verify before unset policy
    LocatedBlock lb = dfs.getClient().getLocatedBlocks(file, 0).get(0);
    Assert.assertTrue(StorageType.ARCHIVE == (lb.getStorageTypes())[0]);
    // unset storage policy
    dfs.unsetStoragePolicy(new Path(file));
    rc = ToolRunner.run(conf, new Mover.Cli(),
        new String[] {"-p", file.toString()});
    Assert.assertEquals("Movement to DISK should be successful", 0, rc);
    lb = dfs.getClient().getLocatedBlocks(file, 0).get(0);
    Assert.assertTrue(StorageType.DISK == (lb.getStorageTypes())[0]);
  } finally {
    cluster.shutdown();
  }
}