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

  final Configuration conf = new HdfsConfiguration();
  conf.set(DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_MODE_KEY,
      StoragePolicySatisfierMode.EXTERNAL.toString());
  final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
      .numDataNodes(3)
      .storageTypes(
          new StorageType[][] {{StorageType.DISK}, {StorageType.DISK},
              {StorageType.DISK}}).build();
  try {
    cluster.waitActive();
    // Simulate External sps by creating #getNameNodeConnector instance.
    DFSTestUtil.getNameNodeConnector(conf, HdfsServerConstants.MOVER_ID_PATH,
        1, true);
    final DistributedFileSystem dfs = cluster.getFileSystem();
    final String file = "/testMoveWhenStoragePolicySatisfierIsRunning";
    // write to DISK
    final FSDataOutputStream out = dfs.create(new Path(file));
    out.writeChars("testMoveWhenStoragePolicySatisfierIsRunning");
    out.close();
    // move to ARCHIVE
    dfs.setStoragePolicy(new Path(file), "COLD");
    int rc = ToolRunner.run(conf, new Mover.Cli(),
        new String[] {"-p", file.toString()});
    int exitcode = ExitStatus.IO_EXCEPTION.getExitCode();
    Assert.assertEquals("Exit code should be " + exitcode, exitcode, rc);
  } finally {
    cluster.shutdown();
  }
}