@Test
public void testNestedUserQueueSecondaryGroup() throws Exception {

  StringBuffer sb = new StringBuffer();
  sb.append("<queuePlacementPolicy>");
  sb.append("  <rule name='nestedUserQueue'>");
  sb.append("       <rule name='secondaryGroupExistingQueue'/>");
  sb.append("  </rule>");
  sb.append("  <rule name='default' />");
  sb.append("</queuePlacementPolicy>");
  QueuePlacementPolicy policy = parse(sb.toString());
  // Should return root.default since secondary groups are not configured
  assertEquals("root.default",
      policy.assignAppToQueue("root.default", "user1"));
  // configure secondary group for user1
  configuredQueues.get(FSQueueType.PARENT).add("root.user1subgroup1");
  policy = parse(sb.toString());
  // user queue created should be created under secondary group
  assertEquals("root.user1subgroup1.user1",
      policy.assignAppToQueue("root.default", "user1"));
}