public void convertQueueHierarchy(FSQueue queue) {
    List<FSQueue> children = queue.getChildQueues();
    final String queueName = queue.getName();

    emitChildQueues(queueName, children);
    emitMaxAMShare(queueName, queue);
    emitMaxParallelApps(queueName, queue);
    emitMaxAllocations(queueName, queue);
    emitPreemptionDisabled(queueName, queue);

    emitChildCapacity(queue);
    emitMaximumCapacity(queueName, queue);
    emitSizeBasedWeight(queueName);
    emitOrderingPolicy(queueName, queue);
    checkMaxChildCapacitySetting(queue);
    emitDefaultUserLimitFactor(queueName, children);

    for (FSQueue childQueue : children) {
      convertQueueHierarchy(childQueue);
    }
  }
@Test
  public void testAutoCreateV2FlagsInWeightMode() {
    converter = builder.withPercentages(false).build();

    converter.convertQueueHierarchy(rootQueue);

    assertTrue("root autocreate v2 flag",
        csConfig.isAutoQueueCreationV2Enabled(ROOT));
    assertTrue("root.admins autocreate v2 flag",
        csConfig.isAutoQueueCreationV2Enabled(ADMINS));
    assertTrue("root.admins.alice autocreate v2 flag",
        csConfig.isAutoQueueCreationV2Enabled(ADMINS_ALICE));
    assertTrue("root.users autocreate v2 flag",
        csConfig.isAutoQueueCreationV2Enabled(USERS));
    assertTrue("root.misc autocreate v2 flag",
        csConfig.isAutoQueueCreationV2Enabled(MISC));

    //leaf queue root.admins.alice is removed from the below list
    //adding reservation to a leaf, it's queueType changes to FSParentQueue
    Set<String> leafs = Sets.difference(ALL_QUEUES,
        Sets.newHashSet("root",
            "root.admins",
            "root.users",
            "root.misc",
            "root.admins.alice"));

    for (String queue : leafs) {
      key = PREFIX + queue + ".auto-queue-creation-v2.enabled";
      assertEquals("Key " + key + " has different value",
          false, csConfig
              .isAutoQueueCreationV2Enabled(new QueuePath(queue)));
    }

  }