use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method getting_global_archived_task_requires_to_be_system_administrator.
@Test
public void getting_global_archived_task_requires_to_be_system_administrator() {
logInAsSystemAdministrator();
CeActivityDto task = createAndPersistArchivedTask(null);
call(task.getUuid());
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method getting_global_archived_throws_ForbiddenException_if_not_system_administrator.
@Test
public void getting_global_archived_throws_ForbiddenException_if_not_system_administrator() {
userSession.logIn().setNonSystemAdministrator();
CeActivityDto task = createAndPersistArchivedTask(null);
expectedException.expect(ForbiddenException.class);
call(task.getUuid());
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method task_is_archived.
@Test
public void task_is_archived() throws Exception {
logInAsRoot();
CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID);
persist(activityDto);
TestResponse wsResponse = ws.newRequest().setMediaType(PROTOBUF).setParam("id", SOME_TASK_UUID).execute();
WsCe.TaskResponse taskResponse = Protobuf.read(wsResponse.getInputStream(), WsCe.TaskResponse.PARSER);
WsCe.Task task = taskResponse.getTask();
assertThat(task.getOrganization()).isEqualTo(organizationDto.getKey());
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
assertThat(task.getComponentId()).isEqualTo(project.uuid());
assertThat(task.getComponentKey()).isEqualTo(project.key());
assertThat(task.getComponentName()).isEqualTo(project.name());
assertThat(task.getAnalysisId()).isEqualTo(activityDto.getAnalysisUuid());
assertThat(task.getExecutionTimeMs()).isEqualTo(500L);
assertThat(task.getLogs()).isFalse();
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method createActivityDto.
private CeActivityDto createActivityDto(String uuid) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setUuid(uuid);
queueDto.setComponentUuid(project.uuid());
CeActivityDto activityDto = new CeActivityDto(queueDto);
activityDto.setStatus(CeActivityDto.Status.FAILED);
activityDto.setExecutionTimeMs(500L);
activityDto.setAnalysisUuid(uuid + "u1");
return activityDto;
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method get_project_archived_task_with_scan_permission_on_project.
@Test
public void get_project_archived_task_with_scan_permission_on_project() {
userSession.logIn().addProjectUuidPermissions(GlobalPermissions.SCAN_EXECUTION, project.uuid());
CeActivityDto task = createAndPersistArchivedTask(project);
call(task.getUuid());
}
Aggregations