use of com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus in project pinot by linkedin.
the class TestAnomalyTaskManager method testDeleteRecordOlderThanDaysWithStatus.
@Test(dependsOnMethods = { "testFindByJobIdStatusNotIn" })
public void testDeleteRecordOlderThanDaysWithStatus() {
TaskStatus status = TaskStatus.COMPLETED;
int numRecordsDeleted = taskDAO.deleteRecordsOlderThanDaysWithStatus(0, status);
Assert.assertEquals(numRecordsDeleted, 1);
}
use of com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus in project pinot by linkedin.
the class TestAnomalyTaskManager method testUpdateStatusAndTaskEndTime.
@Test(dependsOnMethods = { "testFindByStatusOrderByCreationTimeAsc" })
public void testUpdateStatusAndTaskEndTime() {
TaskStatus oldStatus = TaskStatus.RUNNING;
TaskStatus newStatus = TaskStatus.COMPLETED;
long taskEndTime = System.currentTimeMillis();
taskDAO.updateStatusAndTaskEndTime(anomalyTaskId1, oldStatus, newStatus, taskEndTime);
TaskDTO anomalyTask = taskDAO.findById(anomalyTaskId1);
Assert.assertEquals(anomalyTask.getStatus(), newStatus);
Assert.assertEquals(anomalyTask.getEndTime(), taskEndTime);
}
use of com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus in project pinot by linkedin.
the class TestAnomalyTaskManager method testUpdateStatusAndWorkerId.
@Test(dependsOnMethods = { "testFindAll" })
public void testUpdateStatusAndWorkerId() {
TaskStatus newStatus = TaskStatus.RUNNING;
Long workerId = 1L;
TaskDTO taskDTO = taskDAO.findById(anomalyTaskId1);
boolean status = taskDAO.updateStatusAndWorkerId(workerId, anomalyTaskId1, allowedOldTaskStatus, newStatus, taskDTO.getVersion());
TaskDTO anomalyTask = taskDAO.findById(anomalyTaskId1);
Assert.assertTrue(status);
Assert.assertEquals(anomalyTask.getStatus(), newStatus);
Assert.assertEquals(anomalyTask.getWorkerId(), workerId);
Assert.assertEquals(anomalyTask.getVersion(), taskDTO.getVersion() + 1);
}
use of com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus in project pinot by linkedin.
the class TestAnomalyTaskManager method testFindByJobIdStatusNotIn.
@Test(dependsOnMethods = { "testUpdateStatusAndTaskEndTime" })
public void testFindByJobIdStatusNotIn() {
TaskStatus status = TaskStatus.COMPLETED;
List<TaskDTO> anomalyTaskSpecs = taskDAO.findByJobIdStatusNotIn(anomalyJobId, status);
Assert.assertEquals(anomalyTaskSpecs.size(), 1);
}
Aggregations