use of org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID in project sonarqube by SonarSource.
the class SearchActionTest method test_pagination_on_many_pages.
@Test
public void test_pagination_on_many_pages() {
QualityGateDto qualityGate = db.qualityGates().insertQualityGate();
for (int i = 0; i < 20; i++) {
ProjectDto project = db.components().insertPublicProjectDto();
db.qualityGates().associateProjectToQualityGate(project, qualityGate);
}
userSession.addPermission(ADMINISTER_QUALITY_GATES);
SearchResponse response = ws.newRequest().setParam(PARAM_GATE_ID, valueOf(qualityGate.getUuid())).setParam(PARAM_PAGE_SIZE, valueOf(5)).setParam(PARAM_PAGE, valueOf(2)).executeProtobuf(SearchResponse.class);
assertThat(response).extracting(SearchResponse::getMore, searchResponse -> searchResponse.getPaging().getPageIndex(), searchResponse -> searchResponse.getPaging().getPageSize(), searchResponse -> searchResponse.getPaging().getTotal()).contains(true, 2, 5, 20);
}
use of org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID in project sonarqube by SonarSource.
the class SearchActionTest method test_pagination_on_one_page.
@Test
public void test_pagination_on_one_page() {
QualityGateDto qualityGate = db.qualityGates().insertQualityGate();
for (int i = 0; i < 20; i++) {
ProjectDto project = db.components().insertPublicProjectDto();
db.qualityGates().associateProjectToQualityGate(project, qualityGate);
}
userSession.addPermission(ADMINISTER_QUALITY_GATES);
SearchResponse response = ws.newRequest().setParam(PARAM_GATE_ID, valueOf(qualityGate.getUuid())).setParam(PARAM_PAGE_SIZE, valueOf(100)).setParam(PARAM_PAGE, valueOf(1)).executeProtobuf(SearchResponse.class);
assertThat(response).extracting(SearchResponse::getMore, searchResponse -> searchResponse.getPaging().getPageIndex(), searchResponse -> searchResponse.getPaging().getPageSize(), searchResponse -> searchResponse.getPaging().getTotal()).contains(false, 1, 100, 20);
}
Aggregations