Search in sources :

Example 21 with ActivityResponse

use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.

the class ActivityActionTest method assertPage.

private void assertPage(int page, int pageSize, List<String> expectedOrderedTaskIds) {
    ActivityResponse activityResponse = call(ws.newRequest().setParam(Param.PAGE, Integer.toString(page)).setParam(Param.PAGE_SIZE, Integer.toString(pageSize)).setParam(PARAM_STATUS, "SUCCESS,FAILED,CANCELED,IN_PROGRESS,PENDING"));
    assertThat(activityResponse.getPaging().getPageIndex()).isEqualTo(page);
    assertThat(activityResponse.getPaging().getPageSize()).isEqualTo(pageSize);
    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);
    }
}
Also used : ActivityResponse(org.sonarqube.ws.Ce.ActivityResponse)

Example 22 with ActivityResponse

use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.

the class ActivityActionTest method task_without_project.

@Test
public void task_without_project() {
    logInAsSystemAdministrator();
    insertQueue("T3", null, PENDING);
    ActivityResponse activityResponse = call(ws.newRequest().setParam("status", "PENDING"));
    assertThat(activityResponse.getTasksList()).hasSize(1);
}
Also used : ActivityResponse(org.sonarqube.ws.Ce.ActivityResponse) Test(org.junit.Test)

Example 23 with ActivityResponse

use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.

the class ActivityActionTest method remove_queued_already_completed.

@Test
public void remove_queued_already_completed() {
    logInAsSystemAdministrator();
    ComponentDto project1 = db.components().insertPrivateProject();
    insertActivity("T1", project1, SUCCESS);
    insertQueue("T1", project1, IN_PROGRESS);
    ActivityResponse activityResponse = call(ws.newRequest().setParam(Param.PAGE_SIZE, Integer.toString(10)).setParam(PARAM_STATUS, "SUCCESS,FAILED,CANCELED,IN_PROGRESS,PENDING"));
    assertThat(activityResponse.getTasksList()).extracting(Task::getId, Ce.Task::getStatus).containsExactlyInAnyOrder(tuple("T1", Ce.TaskStatus.SUCCESS));
}
Also used : ActivityResponse(org.sonarqube.ws.Ce.ActivityResponse) Ce(org.sonarqube.ws.Ce) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Aggregations

ActivityResponse (org.sonarqube.ws.Ce.ActivityResponse)23 Test (org.junit.Test)21 ComponentDto (org.sonar.db.component.ComponentDto)18 Ce (org.sonarqube.ws.Ce)5 SnapshotDto (org.sonar.db.component.SnapshotDto)3 CeActivityDto (org.sonar.db.ce.CeActivityDto)2 CeQueueDto (org.sonar.db.ce.CeQueueDto)2 Date (java.util.Date)1 DateUtils.formatDate (org.sonar.api.utils.DateUtils.formatDate)1 Task (org.sonarqube.ws.Ce.Task)1