Author: enis
Date: Wed Feb 11 17:39:05 2009
New Revision: 743419

URL: http://svn.apache.org/viewvc?rev=743419&view=rev
Log:
HADOOP-5211. Fix check for job completion in TestSetupAndCleanupFailure. 
Contributed by Enis Soztutar. 

Modified:
    hadoop/core/trunk/CHANGES.txt
    
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSetupAndCleanupFailure.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=743419&r1=743418&r2=743419&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Feb 11 17:39:05 2009
@@ -748,6 +748,9 @@
     HADOOP-5085. Copying a file to local with Crc throws an exception.
     (hairong)
 
+    HADOOP-5211. Fix check for job completion in TestSetupAndCleanupFailure.
+    (enis)
+
 Release 0.19.1 - Unreleased
 
   IMPROVEMENTS

Modified: 
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSetupAndCleanupFailure.java
URL: 
http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSetupAndCleanupFailure.java?rev=743419&r1=743418&r2=743419&view=diff
==============================================================================
--- 
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSetupAndCleanupFailure.java
 (original)
+++ 
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSetupAndCleanupFailure.java
 Wed Feb 11 17:39:05 2009
@@ -23,21 +23,23 @@
 import junit.framework.TestCase;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.mapred.lib.IdentityMapper;
 import org.apache.hadoop.mapred.lib.IdentityReducer;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
 
 public class TestSetupAndCleanupFailure extends TestCase {
 
   static class CommitterWithFailSetup extends FileOutputCommitter {
+    @Override
     public void setupJob(JobContext context) throws IOException {
       throw new IOException();
     }
   }
 
   static class CommitterWithFailCleanup extends FileOutputCommitter {
+    @Override
     public void cleanupJob(JobContext context) throws IOException {
       throw new IOException();
     }
@@ -80,10 +82,10 @@
     MiniMRCluster mr = null;
     FileSystem fileSys = null;
     try {
-      final int taskTrackers = 4;
+      final int taskTrackers = 2;
 
       Configuration conf = new Configuration();
-      dfs = new MiniDFSCluster(conf, 4, true, null);
+      dfs = new MiniDFSCluster(conf, 2, true, null);
       fileSys = dfs.getFileSystem();
       mr = new MiniMRCluster(taskTrackers, fileSys.getUri().toString(), 1);
       JobConf jobConf = mr.createJobConf();
@@ -95,13 +97,13 @@
       jobConf.setOutputCommitter(CommitterWithFailSetup.class);
       job = launchJob(jobConf, inDir, outDir, input);
       // wait for the job to finish.
-      while (!job.isComplete()) ;
+      job.waitForCompletion();
       assertEquals(JobStatus.FAILED, job.getJobState());
 
       jobConf.setOutputCommitter(CommitterWithFailCleanup.class);
       job = launchJob(jobConf, inDir, outDir, input);
       // wait for the job to finish.
-      while (!job.isComplete()) ;
+      job.waitForCompletion();
       assertEquals(JobStatus.FAILED, job.getJobState());
     } finally {
       if (dfs != null) { dfs.shutdown(); }


Reply via email to