use of org.sonarqube.ws.client.measure.ComponentTreeWsRequest in project sonarqube by SonarSource.
the class ComponentTreeSortTest method sort_by_names.
@Test
public void sort_by_names() {
ComponentTreeWsRequest wsRequest = newRequest(singletonList(NAME_SORT), true, null);
List<ComponentDto> result = sortComponents(wsRequest);
assertThat(result).extracting("name").containsExactly("name-1", "name-2", "name-3", "name-4", "name-5", "name-6", "name-7", "name-8", "name-9");
}
use of org.sonarqube.ws.client.measure.ComponentTreeWsRequest in project sonarqube by SonarSource.
the class ComponentTreeSortTest method sort_by_qualifier.
@Test
public void sort_by_qualifier() {
ComponentTreeWsRequest wsRequest = newRequest(singletonList(QUALIFIER_SORT), false, null);
List<ComponentDto> result = sortComponents(wsRequest);
assertThat(result).extracting("qualifier").containsExactly("qualifier-9", "qualifier-8", "qualifier-7", "qualifier-6", "qualifier-5", "qualifier-4", "qualifier-3", "qualifier-2", "qualifier-1");
}
use of org.sonarqube.ws.client.measure.ComponentTreeWsRequest in project sonarqube by SonarSource.
the class ComponentTreeSortTest method sort_by_textual_metric_key_descending.
@Test
public void sort_by_textual_metric_key_descending() {
components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure"));
ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, TEXT_METRIC_KEY);
List<ComponentDto> result = sortComponents(wsRequest);
assertThat(result).extracting("path").containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1", "path-without-measure");
}
use of org.sonarqube.ws.client.measure.ComponentTreeWsRequest in project sonarqube by SonarSource.
the class ComponentTreeSortTest method sort_by_numerical_metric_period_1_key_ascending.
@Test
public void sort_by_numerical_metric_period_1_key_ascending() {
components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure"));
ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), true, NUM_METRIC_KEY).setMetricPeriodSort(1);
List<ComponentDto> result = sortComponents(wsRequest);
assertThat(result).extracting("path").containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1", "path-without-measure");
}
use of org.sonarqube.ws.client.measure.ComponentTreeWsRequest in project sonarqube by SonarSource.
the class ComponentTreeSortTest method sort_on_multiple_fields.
@Test
public void sort_on_multiple_fields() {
components = newArrayList(newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-2"), newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-3"), newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-1"));
ComponentTreeWsRequest wsRequest = newRequest(newArrayList(NAME_SORT, QUALIFIER_SORT, PATH_SORT), true, null);
List<ComponentDto> result = sortComponents(wsRequest);
assertThat(result).extracting("path").containsExactly("path-1", "path-2", "path-3");
}
Aggregations