use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityAction method handle.
@Override
public void handle(Request wsRequest, Response wsResponse) throws Exception {
ActivityResponse activityResponse = doHandle(toSearchWsRequest(wsRequest));
writeProtobuf(activityResponse, wsRequest, wsResponse);
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method search_activity_returns_views_and_developers.
@Test
public void search_activity_returns_views_and_developers() {
OrganizationDto organizationDto = dbTester.organizations().insert();
ComponentDto apacheView = newView(organizationDto).setName("Apache View").setUuid("V1").setProjectUuid("V1");
ComponentDto developer = newDeveloper(organizationDto, "Apache Developer").setUuid("D1").setProjectUuid("D1");
dbTester.components().insertDeveloperAndSnapshot(developer);
dbTester.components().insertViewAndSnapshot(apacheView);
logInAsSystemAdministrator();
insertActivity("T1", "D1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "V1", CeActivityDto.Status.SUCCESS);
ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac"));
assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T1", "T2");
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method project_administrator_can_access_his_project_activity.
@Test
public void project_administrator_can_access_his_project_activity() {
dbTester.components().insertProject(dbTester.organizations().insert(), "PROJECT_1");
// no need to be a system admin
userSession.logIn().addComponentUuidPermission(UserRole.ADMIN, "PROJECT_1", "PROJECT_1");
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "PROJECT_2", CeActivityDto.Status.FAILED);
ActivityResponse activityResponse = call(ws.newRequest().setParam("componentId", "PROJECT_1"));
assertThat(activityResponse.getTasksCount()).isEqualTo(1);
assertThat(activityResponse.getTasks(0).getId()).isEqualTo("T1");
assertThat(activityResponse.getTasks(0).getStatus()).isEqualTo(WsCe.TaskStatus.SUCCESS);
assertThat(activityResponse.getTasks(0).getComponentId()).isEqualTo("PROJECT_1");
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method search_task_id_in_queue_ignoring_other_parameters.
@Test
public void search_task_id_in_queue_ignoring_other_parameters() throws IOException {
logInAsSystemAdministrator();
dbTester.components().insertProject(dbTester.getDefaultOrganization(), "PROJECT_1");
insertQueue("T1", "PROJECT_1", CeQueueDto.Status.IN_PROGRESS);
ActivityResponse result = call(ws.newRequest().setParam(Param.TEXT_QUERY, "T1").setParam(PARAM_STATUS, CeQueueDto.Status.PENDING.name()));
assertThat(result.getTasksCount()).isEqualTo(1);
assertThat(result.getTasks(0).getId()).isEqualTo("T1");
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_on_current_activities.
@Test
public void filter_on_current_activities() {
dbTester.components().insertProject(dbTester.organizations().insert(), "PROJECT_1");
logInAsSystemAdministrator();
// T2 is the current activity (the most recent one)
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "PROJECT_1", CeActivityDto.Status.FAILED);
insertQueue("T3", "PROJECT_1", CeQueueDto.Status.PENDING);
ActivityResponse activityResponse = call(ws.newRequest().setParam("onlyCurrents", "true"));
assertThat(activityResponse.getTasksCount()).isEqualTo(1);
assertThat(activityResponse.getTasks(0).getId()).isEqualTo("T2");
}
Aggregations