public virtual void TestErrorWhileSubmitting() { JobControl jobControl = new JobControl("Test"); Job mockJob = Org.Mockito.Mockito.Mock <Job>(); ControlledJob job1 = new ControlledJob(mockJob, null); Org.Mockito.Mockito.When(mockJob.GetConfiguration()).ThenReturn(new Configuration ()); Org.Mockito.Mockito.DoThrow(new IncompatibleClassChangeError("This is a test")).When (mockJob).Submit(); jobControl.AddJob(job1); RunJobControl(jobControl); try { NUnit.Framework.Assert.AreEqual("Success list", 0, jobControl.GetSuccessfulJobList ().Count); NUnit.Framework.Assert.AreEqual("Failed list", 1, jobControl.GetFailedJobList().Count ); NUnit.Framework.Assert.IsTrue(job1.GetJobState() == ControlledJob.State.Failed); } finally { jobControl.Stop(); } }
/// <exception cref="System.Exception"/> public virtual void TestJobControlWithFailJob() { Log.Info("Starting testJobControlWithFailJob"); Configuration conf = CreateJobConf(); CleanupData(conf); // create a Fail job Job job1 = MapReduceTestUtil.CreateFailJob(conf, outdir_1, indir); // create job dependencies JobControl theControl = CreateDependencies(conf, job1); // wait till all the jobs complete WaitTillAllFinished(theControl); NUnit.Framework.Assert.IsTrue(cjob1.GetJobState() == ControlledJob.State.Failed); NUnit.Framework.Assert.IsTrue(cjob2.GetJobState() == ControlledJob.State.Success); NUnit.Framework.Assert.IsTrue(cjob3.GetJobState() == ControlledJob.State.DependentFailed ); NUnit.Framework.Assert.IsTrue(cjob4.GetJobState() == ControlledJob.State.DependentFailed ); theControl.Stop(); }
public virtual void TestSuccessfulJobs() { JobControl jobControl = new JobControl("Test"); ControlledJob job1 = CreateSuccessfulControlledJob(jobControl); ControlledJob job2 = CreateSuccessfulControlledJob(jobControl); ControlledJob job3 = CreateSuccessfulControlledJob(jobControl, job1, job2); ControlledJob job4 = CreateSuccessfulControlledJob(jobControl, job3); RunJobControl(jobControl); NUnit.Framework.Assert.AreEqual("Success list", 4, jobControl.GetSuccessfulJobList ().Count); NUnit.Framework.Assert.AreEqual("Failed list", 0, jobControl.GetFailedJobList().Count ); NUnit.Framework.Assert.IsTrue(job1.GetJobState() == ControlledJob.State.Success); NUnit.Framework.Assert.IsTrue(job2.GetJobState() == ControlledJob.State.Success); NUnit.Framework.Assert.IsTrue(job3.GetJobState() == ControlledJob.State.Success); NUnit.Framework.Assert.IsTrue(job4.GetJobState() == ControlledJob.State.Success); jobControl.Stop(); }