use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ComponentActionTest method insertQueue.
private CeQueueDto insertQueue(String taskUuid, ComponentDto component, CeQueueDto.Status status) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setComponent(component);
queueDto.setUuid(taskUuid);
queueDto.setStatus(status);
db.getDbClient().ceQueueDao().insert(db.getSession(), queueDto);
db.getSession().commit();
return queueDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ComponentActionTest method insertActivity.
private CeActivityDto insertActivity(String taskUuid, ComponentDto component, CeActivityDto.Status status, @Nullable SnapshotDto analysis) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setComponent(component);
queueDto.setUuid(taskUuid);
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(status);
activityDto.setExecutionTimeMs(500L);
activityDto.setAnalysisUuid(analysis == null ? null : analysis.getUuid());
db.getDbClient().ceActivityDao().insert(db.getSession(), activityDto);
db.getSession().commit();
return activityDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ActivityActionTest method pull_request_in_queue_analysis.
@Test
public void pull_request_in_queue_analysis() {
logInAsSystemAdministrator();
String branch = "pr-123";
CeQueueDto queue1 = insertQueue("T1", null, IN_PROGRESS);
insertCharacteristic(queue1, PULL_REQUEST, branch);
CeQueueDto queue2 = insertQueue("T2", null, PENDING);
insertCharacteristic(queue2, PULL_REQUEST, branch);
ActivityResponse response = ws.newRequest().setParam("status", "FAILED,IN_PROGRESS,PENDING").executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList()).extracting(Task::getId, Ce.Task::getPullRequest, Ce.Task::hasPullRequestTitle, Ce.Task::getStatus).containsExactlyInAnyOrder(tuple("T1", branch, false, Ce.TaskStatus.IN_PROGRESS), tuple("T2", branch, false, Ce.TaskStatus.PENDING));
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ActivityActionTest method branch_in_queue_analysis.
@Test
public void branch_in_queue_analysis() {
logInAsSystemAdministrator();
String branch = "ny_branch";
CeQueueDto queue1 = insertQueue("T1", null, IN_PROGRESS);
insertCharacteristic(queue1, BRANCH_KEY, branch);
insertCharacteristic(queue1, BRANCH_TYPE_KEY, BRANCH.name());
CeQueueDto queue2 = insertQueue("T2", null, PENDING);
insertCharacteristic(queue2, BRANCH_KEY, branch);
insertCharacteristic(queue2, BRANCH_TYPE_KEY, BRANCH.name());
ActivityResponse response = ws.newRequest().setParam("status", "FAILED,IN_PROGRESS,PENDING").executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList()).extracting(Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus).containsExactlyInAnyOrder(tuple("T1", branch, Common.BranchType.BRANCH, Ce.TaskStatus.IN_PROGRESS), tuple("T2", branch, Common.BranchType.BRANCH, Ce.TaskStatus.PENDING));
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class RecentTasksDurationTaskTest method newCeActivityTask.
private CeActivityDto newCeActivityTask(CeActivityDto.Status status) {
CeActivityDto dto = new CeActivityDto(new CeQueueDto());
dto.setStatus(status);
dto.setMainComponentUuid("0");
dto.setExecutionTimeMs(1000L);
return dto;
}
Aggregations