@Test
@TestDir
@TestJetty
@TestHdfs
public void testStoragePolicySatisfier() throws Exception {

  createHttpFSServer(false, false);
  final String dir = "/parent";
  Path path1 = new Path(dir);
  String file = "/parent/file";
  Path filePath = new Path(file);
  DistributedFileSystem dfs = (DistributedFileSystem) FileSystem
      .get(path1.toUri(), TestHdfsHelper.getHdfsConf());
  dfs.mkdirs(path1);
  dfs.create(filePath).close();
  dfs.setStoragePolicy(filePath, HdfsConstants.COLD_STORAGE_POLICY_NAME);
  BlockStoragePolicy storagePolicy =
      (BlockStoragePolicy) dfs.getStoragePolicy(filePath);
  assertEquals(HdfsConstants.COLD_STORAGE_POLICY_NAME,
      storagePolicy.getName());
  HttpURLConnection conn = putCmdWithReturn(dir, "SATISFYSTORAGEPOLICY", "");
  Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  Map<String, byte[]> xAttrs = dfs.getXAttrs(path1);
  assertTrue(
      xAttrs.containsKey(HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY));
}