private static void removeQueue(
          String queueToRemove, CapacitySchedulerConfiguration proposedConf,
          Map<String, String> confUpdate) throws IOException {
    if (queueToRemove == null) {
      return;
    }
    QueuePath queuePath = new QueuePath(queueToRemove);
    if (queuePath.isRoot() || queuePath.isInvalid()) {
      throw new IOException("Can't remove queue " + queuePath.getFullPath());
    }
    String queueName = queuePath.getLeafName();
    List<String> siblingQueues = getSiblingQueues(queuePath,
            proposedConf);
    if (!siblingQueues.contains(queueName)) {
      throw new IOException("Queue " + queuePath.getFullPath() + " not found");
    }
    siblingQueues.remove(queueName);

    QueuePath parentPath = queuePath.getParentObject();
    proposedConf.setQueues(parentPath, siblingQueues.toArray(
            new String[0]));
    String queuesConfig = getQueuesConfig(parentPath);
    if (siblingQueues.isEmpty()) {
      confUpdate.put(queuesConfig, null);
      // Unset Ordering Policy of Leaf Queue converted from
      // Parent Queue after removeQueue
      String queueOrderingPolicy = getOrderingPolicyConfig(parentPath);
      proposedConf.unset(queueOrderingPolicy);
      confUpdate.put(queueOrderingPolicy, null);
    } else {
      confUpdate.put(queuesConfig, Joiner.on(',').join(siblingQueues));
    }
    for (Map.Entry<String, String> confRemove : proposedConf.getValByRegex(
                    ".*" + queuePath.getFullPath() + "\\..*")
            .entrySet()) {
      proposedConf.unset(confRemove.getKey());
      confUpdate.put(confRemove.getKey(), null);
    }
  }
@Test
  public void testRemoveQueue() throws Exception {
    SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
    updateInfo.getRemoveQueueInfo().add(A_PATH);

    Map<String, String> configurationUpdate =
            ConfigurationUpdateAssembler.constructKeyValueConfUpdate(csConfig, updateInfo);

    assertTrue(configurationUpdate.containsKey(A_CONFIG_PATH));
    assertNull(configurationUpdate.get(A_CONFIG_PATH));
    assertEquals("b", configurationUpdate.get(ROOT_QUEUES_PATH));
  }