Search in sources :

Example 1 with TaskStatus

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);
}
Also used : TaskStatus(com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus) Test(org.testng.annotations.Test)

Example 2 with TaskStatus

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);
}
Also used : TaskStatus(com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus) TaskDTO(com.linkedin.thirdeye.datalayer.dto.TaskDTO) Test(org.testng.annotations.Test)

Example 3 with TaskStatus

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);
}
Also used : TaskStatus(com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus) TaskDTO(com.linkedin.thirdeye.datalayer.dto.TaskDTO) Test(org.testng.annotations.Test)

Example 4 with TaskStatus

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);
}
Also used : TaskStatus(com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus) TaskDTO(com.linkedin.thirdeye.datalayer.dto.TaskDTO) Test(org.testng.annotations.Test)

Aggregations

TaskStatus (com.linkedin.thirdeye.anomaly.task.TaskConstants.TaskStatus)4 Test (org.testng.annotations.Test)4 TaskDTO (com.linkedin.thirdeye.datalayer.dto.TaskDTO)3