CgroupsLCEResourcesHandler implements LCEResourcesHandler { int[] getOverallLimits(float yarnProcessorsArg) { return CGroupsCpuResourceHandlerImpl.getOverallLimits(yarnProcessorsArg); } CgroupsLCEResourcesHandler(); @Override void setConf(Configuration conf); @Override Configuration getConf(); void init(LinuxContainerExecutor lce); void preExecute(ContainerId containerId, Resource containerResource); void postExecute(ContainerId containerId); String getResourcesOption(ContainerId containerId);  }
@Test public void testGetOverallLimits() { int expectedQuota = 1000 * 1000; CgroupsLCEResourcesHandler handler = new CgroupsLCEResourcesHandler(); int[] ret = handler.getOverallLimits(2); Assert.assertEquals(expectedQuota / 2, ret[0]); Assert.assertEquals(expectedQuota, ret[1]); ret = handler.getOverallLimits(2000); Assert.assertEquals(expectedQuota, ret[0]); Assert.assertEquals(-1, ret[1]); int[] params = {0, -1}; for (int cores : params) { try { handler.getOverallLimits(cores); Assert.fail("Function call should throw error."); } catch (IllegalArgumentException ie) { } } ret = handler.getOverallLimits(1000 * 1000); Assert.assertEquals(1000 * 1000, ret[0]); Assert.assertEquals(-1, ret[1]); }