use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method search_activity_returns_application.
@Test
public void search_activity_returns_application() {
ComponentDto apacheApp = db.components().insertPublicApplication(a -> a.setName("Apache App"));
db.components().insertSnapshot(apacheApp);
logInAsSystemAdministrator();
insertActivity("T2", apacheApp, SUCCESS);
ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac"));
assertThat(activityResponse.getTasksList()).extracting(Task::getId).containsOnly("T2");
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityAction method handle.
@Override
public void handle(org.sonar.api.server.ws.Request wsRequest, Response wsResponse) throws Exception {
ActivityResponse activityResponse = doHandle(toSearchWsRequest(wsRequest));
writeProtobuf(activityResponse, wsRequest, wsResponse);
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method search_task_id_in_activity.
@Test
public void search_task_id_in_activity() {
logInAsSystemAdministrator();
ComponentDto project = db.components().insertPrivateProject();
insertActivity("T1", project, SUCCESS);
ActivityResponse result = call(ws.newRequest().setParam(Param.TEXT_QUERY, "T1"));
assertThat(result.getTasksCount()).isOne();
assertThat(result.getTasks(0).getId()).isEqualTo("T1");
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method project_administrator_can_access_his_project_activity_using_component_key.
@Test
public void project_administrator_can_access_his_project_activity_using_component_key() {
ComponentDto project1 = db.components().insertPrivateProject();
ComponentDto project2 = db.components().insertPrivateProject();
// no need to be a system admin
userSession.logIn().addProjectPermission(UserRole.ADMIN, project1);
insertActivity("T1", project1, SUCCESS);
insertActivity("T2", project2, FAILED);
ActivityResponse activityResponse = call(ws.newRequest().setParam("component", project1.getDbKey()));
assertThat(activityResponse.getTasksCount()).isOne();
assertThat(activityResponse.getTasks(0).getId()).isEqualTo("T1");
assertThat(activityResponse.getTasks(0).getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(activityResponse.getTasks(0).getComponentId()).isEqualTo(project1.uuid());
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_out_duplicate_tasks_in_progress_and_success.
@Test
public void filter_out_duplicate_tasks_in_progress_and_success() {
logInAsSystemAdministrator();
ComponentDto project1 = db.components().insertPrivateProject();
ComponentDto project2 = db.components().insertPrivateProject();
ComponentDto project3 = db.components().insertPrivateProject();
insertQueue("T2", project2, IN_PROGRESS);
insertQueue("T3", project3, IN_PROGRESS);
insertActivity("T1", project1, SUCCESS);
insertActivity("T2", project2, SUCCESS);
ActivityResponse response = ws.newRequest().setParam("status", "FAILED,IN_PROGRESS,SUCCESS").executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList()).extracting(Task::getId).containsExactlyInAnyOrder("T1", "T2", "T3");
}
Aggregations