use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class SearchEventsActionNewIssuesTest method insertActivity.
private CeActivityDto insertActivity(ComponentDto project, SnapshotDto analysis, CeActivityDto.Status status) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
String mainBranchProjectUuid = project.getMainBranchProjectUuid();
queueDto.setComponentUuid(mainBranchProjectUuid == null ? project.uuid() : mainBranchProjectUuid);
queueDto.setUuid(randomAlphanumeric(40));
queueDto.setCreatedAt(nextLong());
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(status);
activityDto.setExecutionTimeMs(nextLong());
activityDto.setExecutedAt(nextLong());
activityDto.setAnalysisUuid(analysis.getUuid());
db.getDbClient().ceActivityDao().insert(db.getSession(), activityDto);
db.commit();
return activityDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class SearchEventsActionTest method insertActivity.
private CeActivityDto insertActivity(ComponentDto project, SnapshotDto analysis, CeActivityDto.Status status) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
String mainBranchProjectUuid = project.getMainBranchProjectUuid();
queueDto.setComponentUuid(mainBranchProjectUuid == null ? project.uuid() : mainBranchProjectUuid);
queueDto.setUuid(randomAlphanumeric(40));
queueDto.setCreatedAt(nextLong());
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(status);
activityDto.setExecutionTimeMs(nextLong());
activityDto.setExecutedAt(nextLong());
activityDto.setAnalysisUuid(analysis.getUuid());
db.getDbClient().ceActivityDao().insert(db.getSession(), activityDto);
db.commit();
return activityDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method resetTasksWithUnknownWorkerUUIDs_with_empty_set_will_reset_all_in_progress_tasks.
@Test
public void resetTasksWithUnknownWorkerUUIDs_with_empty_set_will_reset_all_in_progress_tasks() {
CeQueueDto u1 = insertCeQueueDto("u1");
CeQueueDto u2 = insertCeQueueDto("u2");
CeQueueDto u6 = insertInProgress("u6", "worker1");
CeQueueDto u7 = insertInProgress("u7", "worker2");
CeQueueDto u8 = insertInProgress("u8", "worker3");
underTest.resetTasksWithUnknownWorkerUUIDs(ImmutableSet.of());
// Pending tasks must not be modified even if a workerUUID is not present
verifyUnmodified(u1);
verifyUnmodified(u2);
// Unknown worker : null, "worker1"
verifyReset(u6);
verifyReset(u7);
verifyReset(u8);
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method verifyCeQueueDtoForTaskSubmit.
private void verifyCeQueueDtoForTaskSubmit(CeTaskSubmit taskSubmit) {
Optional<CeQueueDto> queueDto = db.getDbClient().ceQueueDao().selectByUuid(db.getSession(), taskSubmit.getUuid());
assertThat(queueDto).isPresent();
CeQueueDto dto = queueDto.get();
assertThat(dto.getTaskType()).isEqualTo(taskSubmit.getType());
Optional<CeTaskSubmit.Component> component = taskSubmit.getComponent();
if (component.isPresent()) {
assertThat(dto.getMainComponentUuid()).isEqualTo(component.get().getMainComponentUuid());
assertThat(dto.getComponentUuid()).isEqualTo(component.get().getUuid());
} else {
assertThat(dto.getMainComponentUuid()).isNull();
assertThat(dto.getComponentUuid()).isNull();
}
assertThat(dto.getSubmitterUuid()).isEqualTo(taskSubmit.getSubmitterUuid());
assertThat(dto.getCreatedAt()).isEqualTo(dto.getUpdatedAt());
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method insertCeQueueDto.
private CeQueueDto insertCeQueueDto(String uuid) {
CeQueueDto dto = new CeQueueDto().setUuid(uuid).setTaskType("foo").setStatus(CeQueueDto.Status.PENDING);
db.getDbClient().ceQueueDao().insert(db.getSession(), dto);
db.commit();
return dto;
}
Aggregations