public static boolean validateCSConfiguration(
          final Configuration oldConfParam, final Configuration newConf,
          final RMContext rmContext) throws IOException {
    // ensure that the oldConf is deep copied
    Configuration oldConf = new Configuration(oldConfParam);
    QueueMetrics.setConfigurationValidation(oldConf, true);
    QueueMetrics.setConfigurationValidation(newConf, true);

    CapacityScheduler liveScheduler = (CapacityScheduler) rmContext.getScheduler();
    CapacityScheduler newCs = new CapacityScheduler();
    try {
      //TODO: extract all the validation steps and replace reinitialize with
      //the specific validation steps
      newCs.setConf(oldConf);
      newCs.setRMContext(rmContext);
      newCs.init(oldConf);
      newCs.addNodes(liveScheduler.getAllNodes());
      newCs.reinitialize(newConf, rmContext, true);
      return true;
    } finally {
      newCs.stop();
    }
  }
@Test
  public void testValidateCSConfigDominantRCAbsoluteModeParentMaxMemoryExceeded()
      throws Exception {
    setUpMockRM(true);
    RMContext rmContext = mockRM.getRMContext();
    CapacitySchedulerConfiguration oldConfiguration = cs.getConfiguration();
    CapacitySchedulerConfiguration newConfiguration =
        new CapacitySchedulerConfiguration(cs.getConfiguration());
    newConfiguration.setMaximumResourceRequirement("",
            LEAF_A_FULL_PATH, FULL_MAXRES);
    try {
      CapacitySchedulerConfigValidator
          .validateCSConfiguration(oldConfiguration, newConfiguration, rmContext);
      fail("Parent maximum capacity exceeded");
    } catch (IOException e) {
      Assert.assertTrue(e.getCause().getMessage()
          .startsWith("Max resource configuration"));
    } finally {
      mockRM.stop();
    }
  }