assertTrue(taskRunDAO.isRunning(3));
}
@Test
public void testInterruptRunningTasks() {
TaskRun taskRun1 = new TaskRun(Status.SUCCESS, new Date(), new Date(), "out", "err", "stack", 1);
TaskRun taskRun2 = new TaskRun(Status.CANCELLED, new Date(), new Date(), "out", "err", "stack", 1);
TaskRun taskRun3 = new TaskRun(Status.FAILED, new Date(), new Date(), "out", "err", "stack", 1);
TaskRun taskRun4 = new TaskRun(Status.INTERRUPTED, new Date(), new Date(), "out", "err", "stack", 2);
TaskRun taskRun5 = new TaskRun(Status.RUNNING, new Date(), new Date(), "out", "err", "stack", 2);
TaskRun taskRun6 = new TaskRun(Status.INITIALISING, new Date(), new Date(), "out", "err", "stack", 3);
TaskRun taskRun7 = new TaskRun(Status.CANCELLING, new Date(), new Date(), "out", "err", "stack", 3);
taskRunDAO.save(taskRun1);
taskRunDAO.save(taskRun2);
taskRunDAO.save(taskRun3);
taskRunDAO.save(taskRun4);
taskRunDAO.save(taskRun5);
taskRunDAO.save(taskRun6);
taskRunDAO.save(taskRun7);
taskRunDAO.setInterruptedStatus();
assertEquals(Status.SUCCESS, taskRunDAO.get(taskRun1.getId()).getStatus());
assertEquals(Status.CANCELLED, taskRunDAO.get(taskRun2.getId()).getStatus());
assertEquals(Status.FAILED, taskRunDAO.get(taskRun3.getId()).getStatus());
assertEquals(Status.INTERRUPTED, taskRunDAO.get(taskRun4.getId()).getStatus());
assertEquals(Status.INTERRUPTED, taskRunDAO.get(taskRun5.getId()).getStatus());
assertEquals(Status.INTERRUPTED, taskRunDAO.get(taskRun6.getId()).getStatus());
assertEquals(Status.INTERRUPTED, taskRunDAO.get(taskRun7.getId()).getStatus());
}