Browse Source

MAPREDUCE-4405. Test case for HierarchicalQueue in TestJobQueueClient. Contributed by Mayank Bansal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22@1361335 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko 13 years ago
parent
commit
72cb2beb73

+ 3 - 0
mapreduce/CHANGES.txt

@@ -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

+ 20 - 0
mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java

@@ -24,6 +24,7 @@ import static org.apache.hadoop.mapred.QueueManagerTestUtils.miniMRCluster;
 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;
@@ -42,6 +43,25 @@ public class TestJobQueueClient {
     deleteQueuesConfigFile();
   }
 
+  @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..