use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method getting_project_archived_task_throws_ForbiddenException_if_no_admin_nor_scan_permissions.
@Test
public void getting_project_archived_task_throws_ForbiddenException_if_no_admin_nor_scan_permissions() {
userSession.logIn();
CeActivityDto task = createAndPersistArchivedTask(project);
expectedException.expect(ForbiddenException.class);
call(task.getUuid());
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method get_project_archived_task_with_scan_permission_on_organization_but_not_on_project.
@Test
public void get_project_archived_task_with_scan_permission_on_organization_but_not_on_project() {
userSession.logIn().addPermission(SCAN, project.getOrganizationUuid());
CeActivityDto task = createAndPersistArchivedTask(project);
call(task.getUuid());
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskActionTest method do_not_return_stacktrace_of_failed_activity_without_stacktrace.
@Test
public void do_not_return_stacktrace_of_failed_activity_without_stacktrace() {
logInAsRoot();
CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID).setErrorMessage("error msg");
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.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isFalse();
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskFormatterTest method formatActivity_set_scanner_context_if_argument_is_non_null.
@Test
public void formatActivity_set_scanner_context_if_argument_is_non_null() {
CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED);
String expected = "scanner context baby!";
WsCe.Task wsTask = underTest.formatActivity(db.getSession(), dto, Optional.absent(), expected);
assertThat(wsTask.hasScannerContext()).isTrue();
assertThat(wsTask.getScannerContext()).isEqualTo(expected);
}
use of org.sonar.db.ce.CeActivityDto in project sonarqube by SonarSource.
the class TaskFormatterTest method formatActivity_with_both_error_message_only.
@Test
public void formatActivity_with_both_error_message_only() {
CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED).setErrorMessage("error msg");
WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isFalse();
}
Aggregations