use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method get_project_queue_task_with_scan_permission_on_organization_but_not_on_project.
@Test
public void get_project_queue_task_with_scan_permission_on_organization_but_not_on_project() {
userSession.logIn().addPermission(SCAN, project.getOrganizationUuid());
CeQueueDto task = createAndPersistQueueTask(project);
call(task.getUuid());
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method task_is_in_queue.
@Test
public void task_is_in_queue() throws Exception {
logInAsRoot();
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setUuid(SOME_TASK_UUID);
queueDto.setComponentUuid(project.uuid());
queueDto.setStatus(CeQueueDto.Status.PENDING);
queueDto.setSubmitterLogin("john");
persist(queueDto);
TestResponse wsResponse = ws.newRequest().setMediaType(PROTOBUF).setParam("id", SOME_TASK_UUID).execute();
WsCe.TaskResponse taskResponse = Protobuf.read(wsResponse.getInputStream(), WsCe.TaskResponse.PARSER);
assertThat(taskResponse.getTask().getOrganization()).isEqualTo(organizationDto.getKey());
assertThat(taskResponse.getTask().getId()).isEqualTo(SOME_TASK_UUID);
assertThat(taskResponse.getTask().getStatus()).isEqualTo(WsCe.TaskStatus.PENDING);
assertThat(taskResponse.getTask().getSubmitterLogin()).isEqualTo("john");
assertThat(taskResponse.getTask().getComponentId()).isEqualTo(project.uuid());
assertThat(taskResponse.getTask().getComponentKey()).isEqualTo(project.key());
assertThat(taskResponse.getTask().getComponentName()).isEqualTo(project.name());
assertThat(taskResponse.getTask().hasExecutionTimeMs()).isFalse();
assertThat(taskResponse.getTask().getLogs()).isFalse();
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ActivityActionTest method insertActivity.
private CeActivityDto insertActivity(String taskUuid, String componentUuid, CeActivityDto.Status status) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setComponentUuid(componentUuid);
queueDto.setUuid(taskUuid);
queueDto.setCreatedAt(EXECUTED_AT);
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(status);
activityDto.setExecutionTimeMs(500L);
activityDto.setExecutedAt(EXECUTED_AT);
activityDto.setAnalysisUuid("U1");
dbTester.getDbClient().ceActivityDao().insert(dbTester.getSession(), activityDto);
dbTester.commit();
return activityDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method getting_global_queue_throws_ForbiddenException_if_not_system_administrator.
@Test
public void getting_global_queue_throws_ForbiddenException_if_not_system_administrator() {
userSession.logIn().setNonSystemAdministrator();
CeQueueDto task = createAndPersistQueueTask(null);
expectedException.expect(ForbiddenException.class);
call(task.getUuid());
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method createAndPersistArchivedTask.
private CeActivityDto createAndPersistArchivedTask(@Nullable ComponentDto component) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setUuid(SOME_TASK_UUID);
if (component != null) {
queueDto.setComponentUuid(component.uuid());
}
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(CeActivityDto.Status.FAILED);
activityDto.setExecutionTimeMs(500L);
activityDto.setAnalysisUuid(SOME_TASK_UUID + "_u1");
persist(activityDto);
return activityDto;
}
Aggregations