hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1361071 - in /hadoop/common/branches/branch-0.22/mapreduce: CHANGES.txt src/test/mapred/org/apache/hadoop/mapreduce/TestMRJobClient.java
Date Fri, 13 Jul 2012 07:50:40 GMT
Author: shv
Date: Fri Jul 13 07:50:40 2012
New Revision: 1361071

URL: http://svn.apache.org/viewvc?rev=1361071&view=rev
Log:
MAPREDUCE-4404. Test case for TestMRJobClient to verify user name. 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/mapreduce/TestMRJobClient.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=1361071&r1=1361070&r2=1361071&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt Fri Jul 13 07:50:40 2012
@@ -11,6 +11,9 @@ Release 0.22.1 - Unreleased
     MAPREDUCE-4403. Test case for job resubmission in TestRecoveryManager.
     (Mayank Bansal via shv)
 
+    MAPREDUCE-4404. Test case for TestMRJobClient to verify user name.
+    (Mayank Bansal via shv)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapreduce/TestMRJobClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapreduce/TestMRJobClient.java?rev=1361071&r1=1361070&r2=1361071&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapreduce/TestMRJobClient.java
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapreduce/TestMRJobClient.java
Fri Jul 13 07:50:40 2012
@@ -87,9 +87,29 @@ public class TestMRJobClient extends Clu
   }
 
   @Test
-  public void testJobList(String jobId,
-      Configuration conf) throws Exception {
+  public void testJobList(String jobId, Configuration conf) throws Exception {
     verifyJobPriority(jobId, "HIGH", conf, createJobClient());
+    verifyJobUser(jobId, System.getProperty("user.name"), conf,
+        createJobClient());
+  }
+
+  protected void verifyJobUser(String jobId, String user, Configuration conf,
+      CLI jc) throws Exception {
+    PipedInputStream pis = new PipedInputStream();
+    PipedOutputStream pos = new PipedOutputStream(pis);
+    int exitCode = runTool(conf, jc, new String[] { "-list", "all" }, pos);
+    assertEquals("Exit code", 0, exitCode);
+    BufferedReader br = new BufferedReader(new InputStreamReader(pis));
+    String line = null;
+    while ((line = br.readLine()) != null) {
+      LOG.info("line = " + line);
+      if (!line.startsWith(jobId)) {
+        continue;
+      }
+      assertTrue(line.contains(user));
+      break;
+    }
+    pis.close();
   }
 
   protected void verifyJobPriority(String jobId, String priority,



Mime
View raw message