Author: bobby Date: Thu Nov 15 15:19:30 2012 New Revision: 1409829 URL: http://svn.apache.org/viewvc?rev=1409829&view=rev Log: svn merge -c 1409827 FIXES: YARN-188. Coverage fixing for CapacityScheduler (Aleksey Gorshkov via bobby)
Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1409829&r1=1409828&r2=1409829&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Thu Nov 15 15:19:30 2012 @@ -149,6 +149,9 @@ Release 0.23.6 - UNRELEASED BUG FIXES + YARN-188. Coverage fixing for CapacityScheduler (Aleksey Gorshkov via + bobby) + Release 0.23.5 - UNRELEASED INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java?rev=1409829&r1=1409828&r2=1409829&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java Thu Nov 15 15:19:30 2012 @@ -30,6 +30,8 @@ import org.apache.commons.logging.LogFac import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.net.NetworkTopology; import org.apache.hadoop.yarn.api.records.Priority; +import org.apache.hadoop.yarn.api.records.QueueInfo; +import org.apache.hadoop.yarn.api.records.QueueUserACLInfo; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.event.AsyncDispatcher; @@ -416,5 +418,28 @@ public class TestCapacityScheduler { B3_CAPACITY += B4_CAPACITY; } } + @Test + public void testCapacitySchedulerInfo() throws Exception { + QueueInfo queueInfo = resourceManager.getResourceScheduler().getQueueInfo("a", true, true); + Assert.assertEquals(queueInfo.getQueueName(), "a"); + Assert.assertEquals(queueInfo.getChildQueues().size(), 2); + + List<QueueUserACLInfo> userACLInfo = resourceManager.getResourceScheduler().getQueueUserAclInfo(); + Assert.assertNotNull(userACLInfo); + for (QueueUserACLInfo queueUserACLInfo : userACLInfo) { + Assert.assertEquals(getQueueCount(userACLInfo, queueUserACLInfo.getQueueName()), 1); + } + + } + + private int getQueueCount(List<QueueUserACLInfo> queueInformation, String queueName) { + int result = 0; + for (QueueUserACLInfo queueUserACLInfo : queueInformation) { + if (queueName.equals(queueUserACLInfo.getQueueName())) { + result++; + } + } + return result; + } }