use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method get_all_past_activity.
@Test
public void get_all_past_activity() {
logInAsSystemAdministrator();
OrganizationDto org1 = dbTester.organizations().insert();
dbTester.components().insertProject(org1, "PROJECT_1");
OrganizationDto org2 = dbTester.organizations().insert();
dbTester.components().insertProject(org2, "PROJECT_2");
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "PROJECT_2", CeActivityDto.Status.FAILED);
ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_MAX_EXECUTED_AT, formatDateTime(EXECUTED_AT + 2_000)));
assertThat(activityResponse.getTasksCount()).isEqualTo(2);
// chronological order, from newest to oldest
WsCe.Task task = activityResponse.getTasks(0);
assertThat(task.getOrganization()).isEqualTo(org2.getKey());
assertThat(task.getId()).isEqualTo("T2");
assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
assertThat(task.getComponentId()).isEqualTo("PROJECT_2");
assertThat(task.getAnalysisId()).isEqualTo("U1");
assertThat(task.getExecutionTimeMs()).isEqualTo(500L);
assertThat(task.getLogs()).isFalse();
task = activityResponse.getTasks(1);
assertThat(task.getId()).isEqualTo("T1");
assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.SUCCESS);
assertThat(task.getComponentId()).isEqualTo("PROJECT_1");
assertThat(task.getLogs()).isFalse();
assertThat(task.getOrganization()).isEqualTo(org1.getKey());
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_by_status.
@Test
public void filter_by_status() {
logInAsSystemAdministrator();
dbTester.components().insertProject(dbTester.getDefaultOrganization(), "PROJECT_1");
dbTester.components().insertProject(dbTester.getDefaultOrganization(), "PROJECT_2");
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "PROJECT_2", CeActivityDto.Status.FAILED);
insertQueue("T3", "PROJECT_1", CeQueueDto.Status.IN_PROGRESS);
ActivityResponse activityResponse = call(ws.newRequest().setParam("status", "FAILED,IN_PROGRESS"));
assertThat(activityResponse.getTasksCount()).isEqualTo(2);
assertThat(activityResponse.getTasks(0).getId()).isEqualTo("T3");
assertThat(activityResponse.getTasks(1).getId()).isEqualTo("T2");
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method assertPage.
private void assertPage(int pageSize, List<String> expectedOrderedTaskIds) {
ActivityResponse activityResponse = call(ws.newRequest().setParam(Param.PAGE_SIZE, Integer.toString(pageSize)).setParam(PARAM_STATUS, "SUCCESS,FAILED,CANCELED,IN_PROGRESS,PENDING"));
assertThat(activityResponse.getTasksCount()).isEqualTo(expectedOrderedTaskIds.size());
for (int i = 0; i < expectedOrderedTaskIds.size(); i++) {
String expectedTaskId = expectedOrderedTaskIds.get(i);
assertThat(activityResponse.getTasks(i).getId()).isEqualTo(expectedTaskId);
}
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_by_min_submitted_and_max_executed_at_include_day.
@Test
public void filter_by_min_submitted_and_max_executed_at_include_day() {
logInAsSystemAdministrator();
OrganizationDto organizationDto = dbTester.organizations().insert();
dbTester.components().insertProject(organizationDto, "PROJECT_1");
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
String today = formatDate(new Date(EXECUTED_AT));
ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_MIN_SUBMITTED_AT, today).setParam(PARAM_MAX_EXECUTED_AT, today));
assertThat(activityResponse.getTasksCount()).isEqualTo(1);
}
use of org.sonarqube.ws.WsCe.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_by_max_executed_at_exclude.
@Test
public void filter_by_max_executed_at_exclude() {
logInAsSystemAdministrator();
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "PROJECT_2", CeActivityDto.Status.FAILED);
insertQueue("T3", "PROJECT_1", CeQueueDto.Status.IN_PROGRESS);
ActivityResponse activityResponse = call(ws.newRequest().setParam("status", "FAILED,IN_PROGRESS,SUCCESS").setParam(PARAM_MAX_EXECUTED_AT, "2016-02-15"));
assertThat(activityResponse.getTasksCount()).isEqualTo(0);
}
Aggregations