use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ActivityActionTest method insertQueue.
private CeQueueDto insertQueue(String taskUuid, String componentUuid, CeQueueDto.Status status) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setComponentUuid(componentUuid);
queueDto.setUuid(taskUuid);
queueDto.setStatus(status);
dbTester.getDbClient().ceQueueDao().insert(dbTester.getSession(), queueDto);
dbTester.commit();
return queueDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method createActivityDto.
private CeActivityDto createActivityDto(String uuid) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setUuid(uuid);
queueDto.setComponentUuid(project.uuid());
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(CeActivityDto.Status.FAILED);
activityDto.setExecutionTimeMs(500L);
activityDto.setAnalysisUuid(uuid + "u1");
return activityDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method getting_project_queue_task_throws_ForbiddenException_if_no_admin_nor_scan_permissions.
@Test
public void getting_project_queue_task_throws_ForbiddenException_if_no_admin_nor_scan_permissions() {
userSession.logIn();
CeQueueDto task = createAndPersistQueueTask(project);
expectedException.expect(ForbiddenException.class);
call(task.getUuid());
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskFormatterTest method formatQueues.
@Test
public void formatQueues() throws Exception {
CeQueueDto dto1 = new CeQueueDto();
dto1.setUuid("UUID1");
dto1.setTaskType("TYPE1");
dto1.setStatus(CeQueueDto.Status.IN_PROGRESS);
dto1.setCreatedAt(1_450_000_000_000L);
CeQueueDto dto2 = new CeQueueDto();
dto2.setUuid("UUID2");
dto2.setTaskType("TYPE2");
dto2.setStatus(CeQueueDto.Status.PENDING);
dto2.setCreatedAt(1_451_000_000_000L);
Iterable<WsCe.Task> wsTasks = underTest.formatQueue(db.getSession(), asList(dto1, dto2));
assertThat(wsTasks).extracting("id").containsExactly("UUID1", "UUID2");
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskFormatterTest method formatQueue_compute_execute_time_if_in_progress.
@Test
public void formatQueue_compute_execute_time_if_in_progress() {
long startedAt = 1_450_000_001_000L;
long now = 1_450_000_003_000L;
CeQueueDto dto = new CeQueueDto();
dto.setUuid("UUID");
dto.setTaskType("TYPE");
dto.setStatus(CeQueueDto.Status.IN_PROGRESS);
dto.setCreatedAt(1_450_000_000_000L);
dto.setStartedAt(startedAt);
when(system2.now()).thenReturn(now);
WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto);
assertThat(wsTask.getExecutionTimeMs()).isEqualTo(now - startedAt);
}
Aggregations