ParentQueue extends AbstractCSQueue { @Override public List<QueueUserACLInfo> getQueueUserAclInfo( UserGroupInformation user) { readLock.lock(); try { List<QueueUserACLInfo> userAcls = new ArrayList<>(); userAcls.add(getUserAclInfo(user)); for (CSQueue child : childQueues) { userAcls.addAll(child.getQueueUserAclInfo(user)); } return userAcls; } finally { readLock.unlock(); } } ParentQueue(CapacitySchedulerContext cs,
      String queueName, CSQueue parent, CSQueue old); @Override QueueInfo getQueueInfo(
      boolean includeChildQueues, boolean recursive); @Override List<QueueUserACLInfo> getQueueUserAclInfo(
      UserGroupInformation user); String toString(); @Override void reinitialize(CSQueue newlyParsedQueue,
      Resource clusterResource); @Override void submitApplication(ApplicationId applicationId, String user,
      String queue); void validateSubmitApplication(ApplicationId applicationId,
      String userName, String queue); @Override void submitApplicationAttempt(FiCaSchedulerApp application,
      String userName); @Override void submitApplicationAttempt(FiCaSchedulerApp application,
      String userName, boolean isMoveApp); @Override void finishApplicationAttempt(FiCaSchedulerApp application,
      String queue); @Override void finishApplication(ApplicationId application, String user); @Override CSAssignment assignContainers(Resource clusterResource,
      CandidateNodeSet<FiCaSchedulerNode> candidates,
      ResourceLimits resourceLimits, SchedulingMode schedulingMode); @Override void completedContainer(Resource clusterResource,
      FiCaSchedulerApp application, FiCaSchedulerNode node, 
      RMContainer rmContainer, ContainerStatus containerStatus, 
      RMContainerEventType event, CSQueue completedChildQueue,
      boolean sortQueues); @Override void updateClusterResource(Resource clusterResource,
      ResourceLimits resourceLimits); @Override boolean hasChildQueues(); @Override List<CSQueue> getChildQueues(); @Override void recoverContainer(Resource clusterResource,
      SchedulerApplicationAttempt attempt, RMContainer rmContainer); @Override ActiveUsersManager getAbstractUsersManager(); @Override void collectSchedulerApplications(
      Collection<ApplicationAttemptId> apps); @Override void attachContainer(Resource clusterResource,
      FiCaSchedulerApp application, RMContainer rmContainer); @Override void detachContainer(Resource clusterResource,
      FiCaSchedulerApp application, RMContainer rmContainer); int getNumApplications(); void apply(Resource cluster,
      ResourceCommitRequest<FiCaSchedulerApp, FiCaSchedulerNode> request); @Override void stopQueue(); QueueOrderingPolicy getQueueOrderingPolicy();  }
@Test public void testQueueAcl() throws Exception { setupMultiLevelQueues(csConf); csConf.setAcl(CapacitySchedulerConfiguration.ROOT, QueueACL.SUBMIT_APPLICATIONS, " "); csConf.setAcl(CapacitySchedulerConfiguration.ROOT, QueueACL.ADMINISTER_QUEUE, " "); final String Q_C = CapacitySchedulerConfiguration.ROOT + "." + C; csConf.setAcl(Q_C, QueueACL.ADMINISTER_QUEUE, "*"); final String Q_C11= Q_C + "." + C1 + "." + C11; csConf.setAcl(Q_C11, QueueACL.SUBMIT_APPLICATIONS, "*"); CSQueueStore queues = new CSQueueStore(); CSQueue root = CapacitySchedulerQueueManager.parseQueue(csContext, csConf, null, CapacitySchedulerConfiguration.ROOT, queues, queues, TestUtils.spyHook); YarnAuthorizationProvider authorizer = YarnAuthorizationProvider.getInstance(conf); AppPriorityACLsManager appPriorityACLManager = new AppPriorityACLsManager( conf); CapacitySchedulerQueueManager.setQueueAcls(authorizer, appPriorityACLManager, queues); UserGroupInformation user = UserGroupInformation.getCurrentUser(); ParentQueue c = (ParentQueue)queues.get(C); ParentQueue c1 = (ParentQueue)queues.get(C1); ParentQueue c11 = (ParentQueue)queues.get(C11); ParentQueue c111 = (ParentQueue)queues.get(C111); assertFalse(root.hasAccess(QueueACL.ADMINISTER_QUEUE, user)); List<QueueUserACLInfo> aclInfos = root.getQueueUserAclInfo(user); assertFalse(hasQueueACL(aclInfos, QueueACL.ADMINISTER_QUEUE, "root")); assertFalse(root.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user)); assertFalse(hasQueueACL(aclInfos, QueueACL.SUBMIT_APPLICATIONS, "root")); assertTrue(c.hasAccess(QueueACL.ADMINISTER_QUEUE, user)); assertTrue(hasQueueACL(aclInfos, QueueACL.ADMINISTER_QUEUE, "root.c")); assertFalse(c.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user)); assertFalse(hasQueueACL(aclInfos, QueueACL.SUBMIT_APPLICATIONS, "root.c")); assertTrue(c1.hasAccess(QueueACL.ADMINISTER_QUEUE, user)); assertTrue(hasQueueACL(aclInfos, QueueACL.ADMINISTER_QUEUE, "root.c.c1")); assertFalse(c1.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user)); assertFalse(hasQueueACL( aclInfos, QueueACL.SUBMIT_APPLICATIONS, "root.c.c1")); assertTrue(c11.hasAccess(QueueACL.ADMINISTER_QUEUE, user)); assertTrue(hasQueueACL( aclInfos, QueueACL.ADMINISTER_QUEUE, "root.c.c1.c11")); assertTrue(c11.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user)); assertTrue( hasQueueACL(aclInfos, QueueACL.SUBMIT_APPLICATIONS, "root.c.c1.c11")); assertTrue(c111.hasAccess(QueueACL.ADMINISTER_QUEUE, user)); assertTrue(hasQueueACL( aclInfos, QueueACL.ADMINISTER_QUEUE, "root.c.c1.c11.c111")); assertTrue(c111.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user)); assertTrue(hasQueueACL( aclInfos, QueueACL.SUBMIT_APPLICATIONS, "root.c.c1.c11.c111")); reset(c); }