private void CreateDeadTask() { using (var executionContext = CreateTaskExecutionContextWithNoReprocessing()) { var startedOk = executionContext.TryStart(); if (startedOk) { var values = GetPersonList(6); short maxBlockSize = 3; var listBlocks = executionContext.GetListBlocks<PersonDto>(x => x.WithPeriodicCommit(values, maxBlockSize, BatchSize.Ten)); foreach (var listBlock in listBlocks) { listBlock.Start(); } } } var executionHelper = new ExecutionsHelper(); executionHelper.SetLastExecutionAsDead(_taskDefinitionId); }
private void CreateDeadNumericTask() { using (var executionContext = CreateTaskExecutionContextWithNoReprocessing()) { var startedOk = executionContext.TryStart(); if (startedOk) { long from = 31; long to = 60; short maxBlockSize = 10; var numericBlocks = executionContext.GetNumericRangeBlocks(x => x.WithRange(from, to, maxBlockSize)); foreach (var block in numericBlocks) { block.Start(); } } } var executionHelper = new ExecutionsHelper(); executionHelper.SetLastExecutionAsDead(_taskDefinitionId); }
public void If_LastExecutionDead_ThenReturnStatusIsDead() { // ARRANGE, ACT, ASSERT using (var executionContext = ClientHelper.GetExecutionContext(TestConstants.TaskName, ClientHelper.GetDefaultTaskConfigurationWithKeepAliveAndReprocessing())) { executionContext.TryStart(); Thread.Sleep(200); var helper = new ExecutionsHelper(); helper.SetLastExecutionAsDead(_taskDefinitionId); using (var executionContext2 = ClientHelper.GetExecutionContext(TestConstants.TaskName, ClientHelper.GetDefaultTaskConfigurationWithKeepAliveAndReprocessing())) { var executionMeta = executionContext2.GetLastExecutionMeta(); Assert.AreEqual(Taskling.Tasks.TaskExecutionStatus.Dead, executionMeta.Status); } } }
private void CreateDeadDateTask() { using (var executionContext = CreateTaskExecutionContextWithNoReprocessing()) { var startedOk = executionContext.TryStart(); if (startedOk) { var from = new DateTime(2016, 1, 4); var to = new DateTime(2016, 1, 7); var maxBlockSize = new TimeSpan(1, 0, 0, 0); var dateBlocks = executionContext.GetDateRangeBlocks(x => x.WithRange(from, to, maxBlockSize)); foreach (var block in dateBlocks) { block.Start(); } } } var executionHelper = new ExecutionsHelper(); executionHelper.SetLastExecutionAsDead(_taskDefinitionId); }
private void CreateDeadObjectBlockTask() { using (var executionContext = CreateTaskExecutionContextWithNoReprocessing()) { var startedOk = executionContext.TryStart(); if (startedOk) { var from = new DateTime(2016, 1, 4); var to = new DateTime(2016, 1, 7); var maxBlockSize = new TimeSpan(1, 0, 0, 0); var blocks = executionContext.GetObjectBlocks<string>(x => x.WithObject("Dead Task")); foreach (var block in blocks) { block.Start(); } } } var executionHelper = new ExecutionsHelper(); executionHelper.SetLastExecutionAsDead(_taskDefinitionId); }