@Override protected Job createJob(Configuration conf, JobStateInternal forcedState, String diagnostic) { JobImpl jobImpl = mock(JobImpl.class); when(jobImpl.getInternalState()).thenReturn(this.jobStateInternal); JobID jobID = JobID.forName("job_1234567890000_0001"); JobId jobId = TypeConverter.toYarn(jobID); when(jobImpl.getID()).thenReturn(jobId); ((AppContext) getContext()).getAllJobs().put(jobImpl.getID(), jobImpl); return jobImpl; }
@Override protected Job createJob(Configuration conf) { spiedJob = spy((JobImpl) super.createJob(conf)); ((AppContext) getContext()).getAllJobs().put(spiedJob.getID(), spiedJob); return spiedJob; }