Пример #1
0
        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);
                }
            }
        }
Пример #2
0
        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);
        }
        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);
        }
Пример #4
0
        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);
        }