CGroupsHandlerImpl implements CGroupsHandler { @Override public String getRelativePathForCGroup(String cGroupId) { return cGroupPrefix + Path.SEPARATOR + cGroupId; } CGroupsHandlerImpl(Configuration conf, PrivilegedOperationExecutor
      privilegedOperationExecutor, String mtab);   CGroupsHandlerImpl(Configuration conf, PrivilegedOperationExecutor
      privilegedOperationExecutor); @Override String getControllerPath(CGroupController controller); @Override String getRelativePathForCGroup(String cGroupId); @Override String getPathForCGroup(CGroupController controller, String cGroupId); @Override String getPathForCGroupTasks(CGroupController controller,
      String cGroupId); @Override String getPathForCGroupParam(CGroupController controller,
      String cGroupId, String param); @Override void initializeCGroupController(CGroupController controller); @Override String createCGroup(CGroupController controller, String cGroupId); @Override void deleteCGroup(CGroupController controller, String cGroupId); @Override void updateCGroupParam(CGroupController controller, String cGroupId,
      String param, String value); @Override String getCGroupParam(CGroupController controller, String cGroupId,
      String param); @Override String getCGroupMountPath(); @Override String toString();  }
@Test public void testCgroupsHierarchySetting() throws ResourceHandlerException { YarnConfiguration conf = new YarnConfiguration(); conf.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH, tmpPath); conf.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, "/hadoop-yarn"); CGroupsHandlerImpl cGroupsHandler = new CGroupsHandlerImpl(conf, null); String expectedRelativePath = "hadoop-yarn/c1"; Assert.assertEquals(expectedRelativePath, cGroupsHandler.getRelativePathForCGroup("c1")); conf.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, "hadoop-yarn"); cGroupsHandler = new CGroupsHandlerImpl(conf, null); Assert.assertEquals(expectedRelativePath, cGroupsHandler.getRelativePathForCGroup("c1")); conf.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, "hadoop-yarn/"); cGroupsHandler = new CGroupsHandlerImpl(conf, null); Assert.assertEquals(expectedRelativePath, cGroupsHandler.getRelativePathForCGroup("c1")); conf.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, " cGroupsHandler = new CGroupsHandlerImpl(conf, null); Assert.assertEquals(expectedRelativePath, cGroupsHandler.getRelativePathForCGroup("c1")); expectedRelativePath = "hadoop-yarn/root/c1"; conf.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, " cGroupsHandler = new CGroupsHandlerImpl(conf, null); Assert.assertEquals(expectedRelativePath, cGroupsHandler.getRelativePathForCGroup("c1")); }