Author: shv Date: Fri Jul 13 18:45:27 2012 New Revision: 1361335 URL: http://svn.apache.org/viewvc?rev=1361335&view=rev Log: MAPREDUCE-4405. Test case for HierarchicalQueue in TestJobQueueClient. Contributed by Mayank Bansal.
Modified: hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java Modified: hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt?rev=1361335&r1=1361334&r2=1361335&view=diff ============================================================================== --- hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt (original) +++ hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt Fri Jul 13 18:45:27 2012 @@ -14,6 +14,9 @@ Release 0.22.1 - Unreleased MAPREDUCE-4404. Test case for TestMRJobClient to verify user name. (Mayank Bansal via shv) + MAPREDUCE-4405. Test case for HierarchicalQueue in TestJobQueueClient. + (Mayank Bansal via shv) + OPTIMIZATIONS BUG FIXES Modified: hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java?rev=1361335&r1=1361334&r2=1361335&view=diff ============================================================================== --- hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java (original) +++ hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java Fri Jul 13 18:45:27 2012 @@ -24,6 +24,7 @@ import static org.apache.hadoop.mapred.Q import static org.apache.hadoop.mapred.QueueManagerTestUtils.deleteQueuesConfigFile; import static org.apache.hadoop.mapred.QueueManagerTestUtils.writeToFile; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.io.StringWriter; @@ -43,6 +44,25 @@ public class TestJobQueueClient { } @Test + public void testQueueListwithHierarchicalQueue() throws Exception { + // create some sample queues in a hierarchy.. + JobQueueInfo[] roots = new JobQueueInfo[2]; + roots[0] = new JobQueueInfo("q1", "q1 scheduling info"); + roots[1] = new JobQueueInfo("q2", "q2 scheduling info"); + + List<JobQueueInfo> children = new ArrayList<JobQueueInfo>(); + children.add(new JobQueueInfo("q1:1", null)); + children.add(new JobQueueInfo("q1:2", null)); + roots[0].setChildren(children); + + JobQueueClient client = new JobQueueClient(new JobConf()); + List<JobQueueInfo> allQueues = client.expandQueueList(roots); + + assertNotNull("Queues should not be null", allQueues); + assertEquals(4, allQueues.size()); + } + + @Test public void testQueueOrdering() throws Exception { // create some sample queues in a hierarchy.. JobQueueInfo[] roots = new JobQueueInfo[2];