MAPREDUCE-4571. TestHsWebServicesJobs fails on jdk7. (tgraves via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1457063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2013-03-15 18:51:22 +00:00
parent a21de508a1
commit 1a00fa6e3a
3 changed files with 25 additions and 12 deletions

View File

@ -50,6 +50,8 @@ Release 2.0.5-beta - UNRELEASED
appropriately used and that on-disk segments are correctly sorted on appropriately used and that on-disk segments are correctly sorted on
file-size. (Anty Rao and Ravi Prakash via acmurthy) file-size. (Anty Rao and Ravi Prakash via acmurthy)
MAPREDUCE-4571. TestHsWebServicesJobs fails on jdk7. (tgraves via tucu)
Release 2.0.4-alpha - UNRELEASED Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -77,13 +77,18 @@ public class MockHistoryJobs extends MockJobs {
for(Map.Entry<JobId, Job> entry: mocked.entrySet()) { for(Map.Entry<JobId, Job> entry: mocked.entrySet()) {
JobId id = entry.getKey(); JobId id = entry.getKey();
Job j = entry.getValue(); Job j = entry.getValue();
ret.full.put(id, new MockCompletedJob(j)); MockCompletedJob mockJob = new MockCompletedJob(j);
JobReport report = j.getReport(); // use MockCompletedJob to set everything below to make sure
// consistent with what history server would do
ret.full.put(id, mockJob);
JobReport report = mockJob.getReport();
JobIndexInfo info = new JobIndexInfo(report.getStartTime(), JobIndexInfo info = new JobIndexInfo(report.getStartTime(),
report.getFinishTime(), j.getUserName(), j.getName(), id, report.getFinishTime(), mockJob.getUserName(), mockJob.getName(), id,
j.getCompletedMaps(), j.getCompletedReduces(), String.valueOf(j.getState())); mockJob.getCompletedMaps(), mockJob.getCompletedReduces(),
info.setQueueName(j.getQueueName()); String.valueOf(mockJob.getState()));
info.setQueueName(mockJob.getQueueName());
ret.partial.put(id, new PartialJob(info, id)); ret.partial.put(id, new PartialJob(info, id));
} }
return ret; return ret;
} }
@ -99,12 +104,16 @@ public class MockHistoryJobs extends MockJobs {
@Override @Override
public int getCompletedMaps() { public int getCompletedMaps() {
return job.getCompletedMaps(); // we always return total since this is history server
// and PartialJob also assumes completed - total
return job.getTotalMaps();
} }
@Override @Override
public int getCompletedReduces() { public int getCompletedReduces() {
return job.getCompletedReduces(); // we always return total since this is history server
// and PartialJob also assumes completed - total
return job.getTotalReduces();
} }
@Override @Override

View File

@ -117,6 +117,7 @@ public class TestHsWebServicesJobs extends JerseyTest {
fullJobs = jobs.full; fullJobs = jobs.full;
} }
TestAppContext(int appid, int numJobs, int numTasks, int numAttempts) { TestAppContext(int appid, int numJobs, int numTasks, int numAttempts) {
this(appid, numJobs, numTasks, numAttempts, false); this(appid, numJobs, numTasks, numAttempts, false);
} }
@ -411,7 +412,8 @@ public class TestHsWebServicesJobs extends JerseyTest {
JSONObject json = response.getEntity(JSONObject.class); JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length()); assertEquals("incorrect number of elements", 1, json.length());
JSONObject info = json.getJSONObject("job"); JSONObject info = json.getJSONObject("job");
VerifyJobsUtils.verifyHsJob(info, jobsMap.get(id));
VerifyJobsUtils.verifyHsJob(info, appContext.getJob(id));
} }
} }
@ -613,7 +615,7 @@ public class TestHsWebServicesJobs extends JerseyTest {
JSONObject json = response.getEntity(JSONObject.class); JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length()); assertEquals("incorrect number of elements", 1, json.length());
JSONObject info = json.getJSONObject("jobCounters"); JSONObject info = json.getJSONObject("jobCounters");
verifyHsJobCounters(info, jobsMap.get(id)); verifyHsJobCounters(info, appContext.getJob(id));
} }
} }
@ -631,7 +633,7 @@ public class TestHsWebServicesJobs extends JerseyTest {
JSONObject json = response.getEntity(JSONObject.class); JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length()); assertEquals("incorrect number of elements", 1, json.length());
JSONObject info = json.getJSONObject("jobCounters"); JSONObject info = json.getJSONObject("jobCounters");
verifyHsJobCounters(info, jobsMap.get(id)); verifyHsJobCounters(info, appContext.getJob(id));
} }
} }
@ -689,7 +691,7 @@ public class TestHsWebServicesJobs extends JerseyTest {
JSONObject json = response.getEntity(JSONObject.class); JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length()); assertEquals("incorrect number of elements", 1, json.length());
JSONObject info = json.getJSONObject("jobCounters"); JSONObject info = json.getJSONObject("jobCounters");
verifyHsJobCounters(info, jobsMap.get(id)); verifyHsJobCounters(info, appContext.getJob(id));
} }
} }
@ -711,7 +713,7 @@ public class TestHsWebServicesJobs extends JerseyTest {
is.setCharacterStream(new StringReader(xml)); is.setCharacterStream(new StringReader(xml));
Document dom = db.parse(is); Document dom = db.parse(is);
NodeList info = dom.getElementsByTagName("jobCounters"); NodeList info = dom.getElementsByTagName("jobCounters");
verifyHsJobCountersXML(info, jobsMap.get(id)); verifyHsJobCountersXML(info, appContext.getJob(id));
} }
} }