@Test
public void testGetAllocationFileFromFileSystem()
    throws IOException, URISyntaxException {

  File baseDir =
      new File(TEST_DIR + Path.SEPARATOR + "getAllocHDFS").getAbsoluteFile();
  FileUtil.fullyDelete(baseDir);
  conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getAbsolutePath());
  MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf);
  MiniDFSCluster hdfsCluster = builder.build();
  String fsAllocPath = "hdfs://localhost:" + hdfsCluster.getNameNodePort()
      + Path.SEPARATOR + TEST_FAIRSCHED_XML;
  URL fschedURL = Thread.currentThread().getContextClassLoader()
      .getResource(TEST_FAIRSCHED_XML);
  FileSystem fs = FileSystem.get(conf);
  fs.copyFromLocalFile(new Path(fschedURL.toURI()), new Path(fsAllocPath));
  conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, fsAllocPath);
  AllocationFileLoaderService allocLoader =
      new AllocationFileLoaderService(scheduler);
  Path allocationFile = allocLoader.getAllocationFile(conf);
  assertEquals(fsAllocPath, allocationFile.toString());
  assertTrue(fs.exists(allocationFile));
  hdfsCluster.shutdown(true);
}