use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method peek_ignores_in_progress_tasks.
@Test
public void peek_ignores_in_progress_tasks() {
CeQueueDto dto = db.getDbClient().ceQueueDao().insert(session, new CeQueueDto().setUuid("uuid").setTaskType("foo").setStatus(CeQueueDto.Status.PENDING));
makeInProgress(dto, "foo");
db.commit();
assertThat(underTest.peek(WORKER_UUID_1, true)).isEmpty();
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method insertInProgress.
private CeQueueDto insertInProgress(String uuid, String workerUuid) {
CeQueueDto dto = new CeQueueDto().setUuid(uuid).setTaskType("foo").setStatus(CeQueueDto.Status.PENDING);
db.getDbClient().ceQueueDao().insert(session, dto);
makeInProgress(dto, workerUuid);
db.commit();
return db.getDbClient().ceQueueDao().selectByUuid(session, uuid).get();
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method peek_resets_to_pending_any_task_in_progress_for_specified_worker_uuid_and_updates_updatedAt.
@Test
public void peek_resets_to_pending_any_task_in_progress_for_specified_worker_uuid_and_updates_updatedAt() {
// add a pending one that will be picked so that u1 isn't peek and status reset is visible in DB
insertPending("u0");
// will be picked-because older than any of the reset ones
CeQueueDto u1 = insertPending("u1");
// will be reset
CeQueueDto u2 = insertInProgress("u2", WORKER_UUID_1);
assertThat(underTest.peek(WORKER_UUID_1, true).get().getUuid()).isEqualTo("u0");
verifyUnmodifiedTask(u1);
verifyResetTask(u2);
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method verifyResetTask.
private void verifyResetTask(CeQueueDto originalDto) {
CeQueueDto dto = db.getDbClient().ceQueueDao().selectByUuid(session, originalDto.getUuid()).get();
assertThat(dto.getStatus()).isEqualTo(CeQueueDto.Status.PENDING);
assertThat(dto.getCreatedAt()).isEqualTo(originalDto.getCreatedAt());
assertThat(dto.getUpdatedAt()).isGreaterThan(originalDto.getUpdatedAt());
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ReportAnalysisFailureNotificationExecutionListenerTest method insertActivityDto.
private void insertActivityDto(String taskUuid, int createdAt, @Nullable Long executedAt, ComponentDto project) {
dbClient.ceActivityDao().insert(dbTester.getSession(), new CeActivityDto(new CeQueueDto().setUuid(taskUuid).setTaskType(CeTaskTypes.REPORT).setComponentUuid(project.uuid()).setCreatedAt(createdAt)).setExecutedAt(executedAt).setStatus(CeActivityDto.Status.FAILED));
dbTester.getSession().commit();
}
Aggregations