public virtual void TestCountersOnJobFinish() { TestMRApp.MRAppWithSpiedJob app = new TestMRApp.MRAppWithSpiedJob(this, 1, 1, true , this.GetType().FullName, true); JobImpl job = (JobImpl)app.Submit(new Configuration()); app.WaitForState(job, JobState.Succeeded); app.VerifyCompleted(); System.Console.Out.WriteLine(job.GetAllCounters()); // Just call getCounters job.GetAllCounters(); job.GetAllCounters(); // Should be called only once Org.Mockito.Mockito.Verify(job, Org.Mockito.Mockito.Times(1)).ConstructFinalFullcounters (); }
protected internal override Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job CreateJob( Configuration conf, JobStateInternal forcedState, string diagnostic) { JobImpl jobImpl = Org.Mockito.Mockito.Mock <JobImpl>(); Org.Mockito.Mockito.When(jobImpl.GetInternalState()).ThenReturn(this.jobStateInternal ); Org.Mockito.Mockito.When(jobImpl.GetAllCounters()).ThenReturn(new Counters()); JobID jobID = JobID.ForName("job_1234567890000_0001"); JobId jobId = TypeConverter.ToYarn(jobID); Org.Mockito.Mockito.When(jobImpl.GetID()).ThenReturn(jobId); ((AppContext)this.GetContext()).GetAllJobs()[jobImpl.GetID()] = jobImpl; return(jobImpl); }