public virtual void TestQueueAcl() { SetupMultiLevelQueues(csConf); csConf.SetAcl(CapacitySchedulerConfiguration.Root, QueueACL.SubmitApplications, " " ); csConf.SetAcl(CapacitySchedulerConfiguration.Root, QueueACL.AdministerQueue, " "); string QC = CapacitySchedulerConfiguration.Root + "." + C; csConf.SetAcl(QC, QueueACL.AdministerQueue, "*"); string QC11 = QC + "." + C1 + "." + C11; csConf.SetAcl(QC11, QueueACL.SubmitApplications, "*"); IDictionary <string, CSQueue> queues = new Dictionary <string, CSQueue>(); CSQueue root = CapacityScheduler.ParseQueue(csContext, csConf, null, CapacitySchedulerConfiguration .Root, queues, queues, TestUtils.spyHook); YarnAuthorizationProvider authorizer = YarnAuthorizationProvider.GetInstance(conf ); CapacityScheduler.SetQueueAcls(authorizer, queues); UserGroupInformation user = UserGroupInformation.GetCurrentUser(); // Setup queue configs ParentQueue c = (ParentQueue)queues[C]; ParentQueue c1 = (ParentQueue)queues[C1]; ParentQueue c11 = (ParentQueue)queues[C11]; ParentQueue c111 = (ParentQueue)queues[C111]; NUnit.Framework.Assert.IsFalse(root.HasAccess(QueueACL.AdministerQueue, user)); IList <QueueUserACLInfo> aclInfos = root.GetQueueUserAclInfo(user); NUnit.Framework.Assert.IsFalse(HasQueueACL(aclInfos, QueueACL.AdministerQueue, "root" )); NUnit.Framework.Assert.IsFalse(root.HasAccess(QueueACL.SubmitApplications, user)); NUnit.Framework.Assert.IsFalse(HasQueueACL(aclInfos, QueueACL.SubmitApplications, "root")); // c has no SA, but QA NUnit.Framework.Assert.IsTrue(c.HasAccess(QueueACL.AdministerQueue, user)); NUnit.Framework.Assert.IsTrue(HasQueueACL(aclInfos, QueueACL.AdministerQueue, "c" )); NUnit.Framework.Assert.IsFalse(c.HasAccess(QueueACL.SubmitApplications, user)); NUnit.Framework.Assert.IsFalse(HasQueueACL(aclInfos, QueueACL.SubmitApplications, "c")); //Queue c1 has QA, no SA (gotten perm from parent) NUnit.Framework.Assert.IsTrue(c1.HasAccess(QueueACL.AdministerQueue, user)); NUnit.Framework.Assert.IsTrue(HasQueueACL(aclInfos, QueueACL.AdministerQueue, "c1" )); NUnit.Framework.Assert.IsFalse(c1.HasAccess(QueueACL.SubmitApplications, user)); NUnit.Framework.Assert.IsFalse(HasQueueACL(aclInfos, QueueACL.SubmitApplications, "c1")); //Queue c11 has permissions from parent queue and SA NUnit.Framework.Assert.IsTrue(c11.HasAccess(QueueACL.AdministerQueue, user)); NUnit.Framework.Assert.IsTrue(HasQueueACL(aclInfos, QueueACL.AdministerQueue, "c11" )); NUnit.Framework.Assert.IsTrue(c11.HasAccess(QueueACL.SubmitApplications, user)); NUnit.Framework.Assert.IsTrue(HasQueueACL(aclInfos, QueueACL.SubmitApplications, "c11")); //Queue c111 has SA and AQ, both from parent NUnit.Framework.Assert.IsTrue(c111.HasAccess(QueueACL.AdministerQueue, user)); NUnit.Framework.Assert.IsTrue(HasQueueACL(aclInfos, QueueACL.AdministerQueue, "c111" )); NUnit.Framework.Assert.IsTrue(c111.HasAccess(QueueACL.SubmitApplications, user)); NUnit.Framework.Assert.IsTrue(HasQueueACL(aclInfos, QueueACL.SubmitApplications, "c111")); Org.Mockito.Mockito.Reset(c); }