MiniMRCluster mr = null;
mr = new MiniMRCluster(2, "file:///", 3, null, null, conf);
JobTracker jt = mr.getJobTrackerRunner().getJobTracker();
JobHistory jh = jt.getJobHistory();
jh.init(jt, conf, "localhost", 1234);
JobID jobId = JobID.forName("job_200809171136_0001");
jh.setupEventWriter(jobId, conf);
Map<JobACL, AccessControlList> jobACLs =
new HashMap<JobACL, AccessControlList>();
AccessControlList viewJobACL =
new AccessControlList("user1,user2 group1,group2");
AccessControlList modifyJobACL =
new AccessControlList("user3,user4 group3, group4");
jobACLs.put(JobACL.VIEW_JOB, viewJobACL);
jobACLs.put(JobACL.MODIFY_JOB, modifyJobACL);
JobSubmittedEvent jse =
new JobSubmittedEvent(jobId, weirdJob, username, 12345, weirdPath,
jobACLs);
jh.logEvent(jse, jobId);
JobFinishedEvent jfe =
new JobFinishedEvent(jobId, 12346, 1, 1, 0, 0, new Counters(),
new Counters(), new Counters());
jh.logEvent(jfe, jobId);
jh.closeWriter(jobId);
// Try to write one more event now, should not fail
TaskID tid = TaskID.forName("task_200809171136_0001_m_000002");
TaskFinishedEvent tfe =
new TaskFinishedEvent(tid, 0, TaskType.MAP, "", null);
boolean caughtException = false;
try {
jh.logEvent(tfe, jobId);
} catch (Exception e) {
caughtException = true;
}
assertFalse("Writing an event after closing event writer is not handled",