diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 5d71309d31..de372342d7 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -293,6 +293,9 @@ Release 0.23.1 - Unreleased in the correct directory to work properly in secure mode. (Hitesh Shah via vinodkv) + MAPREDUCE-3541. Fix broken TestJobQueueClient test. (Ravi Prakash via + mahadev) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobQueueClient.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobQueueClient.java index c7834adb7e..44669ec686 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobQueueClient.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobQueueClient.java @@ -109,7 +109,14 @@ public int run(String[] argv) throws Exception { return exitcode; } +// format and print information about the passed in job queue. + void printJobQueueInfo(JobQueueInfo jobQueueInfo, Writer writer) + throws IOException { + printJobQueueInfo(jobQueueInfo, writer, ""); + } + // format and print information about the passed in job queue. + @SuppressWarnings("deprecation") void printJobQueueInfo(JobQueueInfo jobQueueInfo, Writer writer, String prefix) throws IOException { if (jobQueueInfo == null) { @@ -136,7 +143,7 @@ void printJobQueueInfo(JobQueueInfo jobQueueInfo, Writer writer, private void displayQueueList() throws IOException { JobQueueInfo[] rootQueues = jc.getRootQueues(); for (JobQueueInfo queue : rootQueues) { - printJobQueueInfo(queue, new PrintWriter(System.out), ""); + printJobQueueInfo(queue, new PrintWriter(System.out)); } } @@ -174,7 +181,7 @@ private void displayQueueInfo(String queue, boolean showJobs) System.out.println("Queue \"" + queue + "\" does not exist."); return; } - printJobQueueInfo(jobQueueInfo, new PrintWriter(System.out), ""); + printJobQueueInfo(jobQueueInfo, new PrintWriter(System.out)); if (showJobs && (jobQueueInfo.getChildren() == null || jobQueueInfo.getChildren().size() == 0)) { JobStatus[] jobs = jc.getJobsFromQueue(queue); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobQueueClient.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobQueueClient.java index 636b12a89d..491516995f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobQueueClient.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobQueueClient.java @@ -45,7 +45,7 @@ public void testPrintJobQueueInfo() throws IOException { ByteArrayOutputStream bbos = new ByteArrayOutputStream(); PrintWriter writer = new PrintWriter(bbos); - queueClient.printJobQueueInfo(parent, writer, ""); + queueClient.printJobQueueInfo(parent, writer); Assert.assertTrue("printJobQueueInfo did not print grandchild's name", bbos.toString().contains("GrandChildQueue")); diff --git a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java index 7b9f3c1c3b..d25a165f43 100644 --- a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java +++ b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java @@ -30,6 +30,8 @@ import java.util.ArrayList; import java.util.List; +import junit.framework.Assert; + import org.apache.hadoop.mapreduce.QueueInfo; import org.junit.After; import org.junit.Test; @@ -79,14 +81,11 @@ public void testQueueInfoPrinting() throws Exception { StringWriter writer = new StringWriter(); client.printJobQueueInfo(root, writer); - StringBuffer sb = new StringBuffer(); - sb.append("Queue Name : q1 \n"); - sb.append("Queue State : running \n"); - sb.append("Scheduling Info : q1 scheduling info \n"); - sb.append("Child Queues : q1:1, q1:2\n"); - sb.append("======================\n"); - - assertEquals(sb.toString(), writer.toString()); + Assert.assertTrue(writer.toString().contains("Queue Name : q1")); + Assert.assertTrue(writer.toString().contains("Queue State : running")); + Assert.assertTrue(writer.toString().contains("Scheduling Info : q1 scheduling info")); + Assert.assertTrue(writer.toString().contains("Queue Name : q1:1")); + Assert.assertTrue(writer.toString().contains("Queue Name : q1:2")); } @Test