use of org.sonarqube.ws.Ce.Task in project sonarqube by SonarSource.
the class ActivityActionTest method get_all_past_activity.
@Test
public void get_all_past_activity() {
logInAsSystemAdministrator();
ComponentDto project1 = db.components().insertPrivateProject();
ComponentDto project2 = db.components().insertPrivateProject();
SnapshotDto analysisProject1 = db.components().insertSnapshot(project1);
insertActivity("T1", project1, SUCCESS, analysisProject1);
insertActivity("T2", project2, FAILED, null);
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
Task task = activityResponse.getTasks(0);
assertThat(task.getId()).isEqualTo("T2");
assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED);
assertThat(task.getComponentId()).isEqualTo(project2.uuid());
assertThat(task.hasAnalysisId()).isFalse();
assertThat(task.getExecutionTimeMs()).isEqualTo(500L);
assertThat(task.getWarningCount()).isZero();
task = activityResponse.getTasks(1);
assertThat(task.getId()).isEqualTo("T1");
assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(task.getComponentId()).isEqualTo(project1.uuid());
assertThat(task.getWarningCount()).isZero();
}
Aggregations