public virtual void testMonitorJobPollingForCompletion() { var processDefinition = testRule.DeployAndGetDefinition(instance); var batch = helper.StartAfterAsync("process1", 3, "user1", processDefinition.Id); // when the seed job creates the monitor job var createDate = ClockTestUtil.SetClockToDateWithoutMilliseconds(); helper.ExecuteSeedJob(batch); // then the monitor job has a no due date set var monitorJob = helper.GetMonitorJob(batch); Assert.NotNull(monitorJob); Assert.IsNull(monitorJob.Duedate); // when the monitor job is executed helper.ExecuteMonitorJob(batch); // then the monitor job has a due date of the default batch poll time monitorJob = helper.GetMonitorJob(batch); var dueDate = helper.AddSeconds(createDate, 30); Assert.AreEqual(dueDate, monitorJob.Duedate); }
public virtual void testHistoricMonitorJobLog() { var processDefinition = testRule.DeployAndGetDefinition(instance); var batch = helper.StartAfterAsync("process1", 1, "user1", processDefinition.Id); // when the seed job is executed helper.ExecuteSeedJob(batch); var monitorJob = helper.GetMonitorJob(batch); var jobLogs = helper.GetHistoricMonitorJobLog(batch, monitorJob); Assert.AreEqual(1, jobLogs.Count); // then a creation historic job log exists for the monitor job without due date var jobLog = jobLogs[0]; AssertCommonMonitorJobLogProperties(batch, jobLog); Assert.True(jobLog.CreationLog); Assert.AreEqual(START_DATE, jobLog.TimeStamp); Assert.IsNull(jobLog.JobDueDate); // when the monitor job is executed var executionDate = helper.AddSecondsToClock(15); var monitorJobDueDate = helper.AddSeconds(executionDate, 30); helper.ExecuteMonitorJob(batch); jobLogs = helper.GetHistoricMonitorJobLog(batch, monitorJob); Assert.AreEqual(2, jobLogs.Count); // then a success job log was created for the last monitor job jobLog = jobLogs[1]; AssertCommonMonitorJobLogProperties(batch, jobLog); Assert.True(jobLog.SuccessLog); Assert.AreEqual(executionDate, jobLog.TimeStamp); Assert.IsNull(jobLog.JobDueDate); // and a creation job log for the new monitor job was created with due date monitorJob = helper.GetMonitorJob(batch); jobLogs = helper.GetHistoricMonitorJobLog(batch, monitorJob); Assert.AreEqual(1, jobLogs.Count); jobLog = jobLogs[0]; AssertCommonMonitorJobLogProperties(batch, jobLog); Assert.True(jobLog.CreationLog); Assert.AreEqual(executionDate, jobLog.TimeStamp); Assert.AreEqual(monitorJobDueDate, jobLog.JobDueDate); // when the modification and monitor jobs are executed executionDate = helper.AddSecondsToClock(15); helper.ExecuteJobs(batch); helper.ExecuteMonitorJob(batch); jobLogs = helper.GetHistoricMonitorJobLog(batch, monitorJob); Assert.AreEqual(2, jobLogs.Count); // then a success job log was created for the last monitor job jobLog = jobLogs[1]; AssertCommonMonitorJobLogProperties(batch, jobLog); Assert.True(jobLog.SuccessLog); Assert.AreEqual(executionDate, jobLog.TimeStamp); Assert.AreEqual(monitorJobDueDate, jobLog.JobDueDate); }