use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskFormatterTest method formatQueue_do_not_fail_if_component_not_found.
@Test
public void formatQueue_do_not_fail_if_component_not_found() throws Exception {
CeQueueDto dto = new CeQueueDto();
dto.setUuid("UUID");
dto.setTaskType("TYPE");
dto.setStatus(CeQueueDto.Status.IN_PROGRESS);
dto.setCreatedAt(1_450_000_000_000L);
dto.setComponentUuid("DOES_NOT_EXIST");
WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto);
assertThat(wsTask.getComponentId()).isEqualTo("DOES_NOT_EXIST");
assertThat(wsTask.hasComponentKey()).isFalse();
assertThat(wsTask.hasComponentName()).isFalse();
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class PurgeCeActivitiesTest method insertWithDate.
private void insertWithDate(String uuid, long date) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setUuid(uuid);
queueDto.setTaskType(CeTaskTypes.REPORT);
CeActivityDto dto = new CeActivityDto(queueDto);
dto.setStatus(CeActivityDto.Status.SUCCESS);
when(system2.now()).thenReturn(date);
dbTester.getDbClient().ceActivityDao().insert(dbTester.getSession(), dto);
dbTester.getSession().commit();
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class CeQueueCleanerTest method insertInQueue.
private CeQueueDto insertInQueue(String taskUuid, CeQueueDto.Status status) throws IOException {
CeQueueDto dto = new CeQueueDto();
dto.setTaskType(CeTaskTypes.REPORT);
dto.setComponentUuid("PROJECT_1");
dto.setUuid(taskUuid);
dto.setStatus(status);
dbTester.getDbClient().ceQueueDao().insert(dbTester.getSession(), dto);
dbTester.getSession().commit();
return dto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class CeQueueImpl method cancelAll.
protected int cancelAll(boolean includeInProgress) {
int count = 0;
try (DbSession dbSession = dbClient.openSession(false)) {
for (CeQueueDto queueDto : dbClient.ceQueueDao().selectAllInAscOrder(dbSession)) {
if (includeInProgress || !queueDto.getStatus().equals(CeQueueDto.Status.IN_PROGRESS)) {
cancelImpl(dbSession, queueDto);
count++;
}
}
return count;
}
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class CeQueueImpl method submit.
@Override
public CeTask submit(CeTaskSubmit submission) {
checkState(!submitPaused.get(), "Compute Engine does not currently accept new tasks");
try (DbSession dbSession = dbClient.openSession(false)) {
CeQueueDto dto = new CeTaskSubmitToInsertedCeQueueDto(dbSession, dbClient).apply(submission);
CeTask task = loadTask(dbSession, dto);
dbSession.commit();
return task;
}
}
Aggregations