NodeManagerHardwareUtils { public static int getVCores(Configuration conf) { ResourceCalculatorPlugin plugin = ResourceCalculatorPlugin.getResourceCalculatorPlugin(null, conf); return NodeManagerHardwareUtils.getVCores(plugin, conf); }  static int getNodeCPUs(Configuration conf); static int getNodeCPUs(ResourceCalculatorPlugin plugin,
      Configuration conf); static float getContainersCPUs(Configuration conf); static float getContainersCPUs(ResourceCalculatorPlugin plugin,
      Configuration conf); static int getNodeCpuPercentage(Configuration conf); static int getVCores(Configuration conf); static int getVCores(ResourceCalculatorPlugin plugin,
      Configuration conf); static int getContainerMemoryMB(Configuration conf); static int getContainerMemoryMB(ResourceCalculatorPlugin plugin,
      Configuration conf);  }
@Test public void testGetVCores() { ResourceCalculatorPlugin plugin = new TestResourceCalculatorPlugin(); YarnConfiguration conf = new YarnConfiguration(); conf.setFloat(YarnConfiguration.NM_PCORES_VCORES_MULTIPLIER, 1.25f); int ret = NodeManagerHardwareUtils.getVCores(plugin, conf); Assert.assertEquals(YarnConfiguration.DEFAULT_NM_VCORES, ret); conf.setBoolean(YarnConfiguration.NM_ENABLE_HARDWARE_CAPABILITY_DETECTION, true); ret = NodeManagerHardwareUtils.getVCores(plugin, conf); Assert.assertEquals(5, ret); conf.setBoolean(YarnConfiguration.NM_COUNT_LOGICAL_PROCESSORS_AS_CORES, true); ret = NodeManagerHardwareUtils.getVCores(plugin, conf); Assert.assertEquals(10, ret); conf.setInt(YarnConfiguration.NM_VCORES, 10); ret = NodeManagerHardwareUtils.getVCores(plugin, conf); Assert.assertEquals(10, ret); YarnConfiguration conf1 = new YarnConfiguration(); conf1.setBoolean(YarnConfiguration.NM_ENABLE_HARDWARE_CAPABILITY_DETECTION, false); conf.setInt(YarnConfiguration.NM_VCORES, 10); ret = NodeManagerHardwareUtils.getVCores(plugin, conf); Assert.assertEquals(10, ret); }