Пример #1
0
 public void CancelTestRun(ITestRun testRun)
 {
     TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && !task.IsFinished() && !task.IsActive()).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Canceled);
     testRun.Status = TestRunStatuses.Cancelled;
     if (TaskPool.TasksForClients.Any(task => task.TestRunId == testRun.Id && task.IsActive())) {
         TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && task.IsActive()).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Interrupted);
         testRun.Status = TestRunStatuses.Cancelling;
     }
     
     // disconnecting clients
     ClientsCollection.Clients.RemoveAll(client => client.TestRunId == testRun.Id);
     testRun.SetTimeTaken();
     RunNextInRowTestRun();
 }
Пример #2
0
        public virtual void CancelTestRun(ITestRun testRun)
        {
            TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && !task.IsFinished() && !task.IsActive() && !task.IsCancel).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Canceled);
            var activeTasks = TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && task.IsActive()).ToList();

            if (activeTasks.Any())
            {
                // 20150918
                // temporarily
                // until there'll be async execution of task here
                // linked lines of code 20150918-001
                // activeTasks.ForEach(task => { if (!task.IsCancel) task.TaskStatus = TestTaskStatuses.InterruptedByUser; });
                // TODO: provide all clients that ran active tasks with newly available tasks
                // however clients can't interrupt their tasks
                //
                testRun.Status = TestRunStatuses.Canceling;
            }
            else
            {
                testRun.Status = TestRunStatuses.Canceled;
            }

            // TODO: set test run status Canceled after all isCancel tasks have finished

            // disconnecting clients
            // 20150807
            // ClientsCollection.Clients.RemoveAll(client => client.TestRunId == testRun.Id);

            // 20150909
            // no more unregistration of clients
            // testRun.UnregisterClients();
            // set time only for completely cancelled test runs
            // testRun.SetTimeTaken();
            if (TestRunStatuses.Canceled == testRun.Status)
            {
                testRun.SetTimeTaken();
            }

            // 20150909
            // RunNextInRowTestRun();
            if (TestRunStatuses.Canceled == testRun.Status)
            {
                RunNextInRowTestRun();
            }
        }
Пример #3
0
        public virtual void CancelTestRun(ITestRun testRun)
        {
            TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && !task.IsFinished() && !task.IsActive() && !task.IsCancel).ToList().ForEach(task => task.TaskStatus = TestTaskStatuses.Canceled);
            var activeTasks = TaskPool.TasksForClients.Where(task => task.TestRunId == testRun.Id && task.IsActive()).ToList();
            if (activeTasks.Any())
            {
                // 20150918
                // temporarily
                // until there'll be async execution of task here
                // linked lines of code 20150918-001
                // activeTasks.ForEach(task => { if (!task.IsCancel) task.TaskStatus = TestTaskStatuses.InterruptedByUser; });
                // TODO: provide all clients that ran active tasks with newly available tasks
                // however clients can't interrupt their tasks
                // 
                testRun.Status = TestRunStatuses.Canceling;
            }
            else
            {
                testRun.Status = TestRunStatuses.Canceled;
            }

            // TODO: set test run status Canceled after all isCancel tasks have finished
            
            // disconnecting clients
            // 20150807
            // ClientsCollection.Clients.RemoveAll(client => client.TestRunId == testRun.Id);

            // 20150909
            // no more unregistration of clients
            // testRun.UnregisterClients();
            // set time only for completely cancelled test runs
            // testRun.SetTimeTaken();
            if (TestRunStatuses.Canceled == testRun.Status)
                testRun.SetTimeTaken();

            // 20150909
            // RunNextInRowTestRun();
            if (TestRunStatuses.Canceled == testRun.Status)
                RunNextInRowTestRun();
        }