Author: jlowe Date: Wed Nov 13 15:49:29 2013 New Revision: 1541566 URL: http://svn.apache.org/r1541566 Log: MAPREDUCE-5610. TestSleepJob fails in jdk7. Contributed by Jonathan Eagles
Modified: hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/JobCreator.java hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/TestSleepJob.java Modified: hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/JobCreator.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/JobCreator.java?rev=1541566&r1=1541565&r2=1541566&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/JobCreator.java (original) +++ hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/JobCreator.java Wed Nov 13 15:49:29 2013 @@ -63,8 +63,8 @@ public enum JobCreator { Configuration conf, long submissionMillis, JobStory jobdesc, Path outRoot, UserGroupInformation ugi, int seq) throws IOException { int numLocations = conf.getInt(SLEEPJOB_RANDOM_LOCATIONS, 0); - if (numLocations < 0) numLocations=0; - if ((numLocations > 0) && (hosts == null)) { + if (numLocations < 0) numLocations = 0; + if (hosts == null) { final JobClient client = new JobClient(new JobConf(conf)); ClusterStatus stat = client.getClusterStatus(true); final int nTrackers = stat.getTaskTrackers(); Modified: hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/TestSleepJob.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/TestSleepJob.java?rev=1541566&r1=1541565&r2=1541566&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/TestSleepJob.java (original) +++ hadoop/common/trunk/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/TestSleepJob.java Wed Nov 13 15:49:29 2013 @@ -58,17 +58,6 @@ public class TestSleepJob extends Common } - /* - * test RandomLocation - */ - @Test - public void testRandomLocation() throws Exception { - UserGroupInformation ugi = UserGroupInformation.getLoginUser(); - - testRandomLocation(1, 10, ugi); - testRandomLocation(2, 10, ugi); - } - @Test public void testMapTasksOnlySleepJobs() throws Exception { Configuration configuration = GridmixTestUtils.mrvl.getConfig(); @@ -90,6 +79,17 @@ public class TestSleepJob extends Common assertEquals(6, seq); } + /* + * test RandomLocation + */ + @Test + public void testRandomLocation() throws Exception { + UserGroupInformation ugi = UserGroupInformation.getLoginUser(); + + testRandomLocation(1, 10, ugi); + testRandomLocation(2, 10, ugi); + } + // test Serial submit @Test public void testSerialSubmit() throws Exception {