Search in sources :

Example 11 with ComponentTreeWsRequest

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");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) ComponentTreeWsRequest(org.sonarqube.ws.client.measure.ComponentTreeWsRequest) Test(org.junit.Test)

Example 12 with ComponentTreeWsRequest

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");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) ComponentTreeWsRequest(org.sonarqube.ws.client.measure.ComponentTreeWsRequest) Test(org.junit.Test)

Example 13 with ComponentTreeWsRequest

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");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) ComponentTreeWsRequest(org.sonarqube.ws.client.measure.ComponentTreeWsRequest) Test(org.junit.Test)

Example 14 with ComponentTreeWsRequest

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");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) ComponentTreeWsRequest(org.sonarqube.ws.client.measure.ComponentTreeWsRequest) Test(org.junit.Test)

Example 15 with ComponentTreeWsRequest

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");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) ComponentTreeWsRequest(org.sonarqube.ws.client.measure.ComponentTreeWsRequest) Test(org.junit.Test)

Aggregations

ComponentTreeWsRequest (org.sonarqube.ws.client.measure.ComponentTreeWsRequest)16 Test (org.junit.Test)14 ComponentDto (org.sonar.db.component.ComponentDto)12 ComponentTreeWsResponse (org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse)2 CollectionCondition (com.codeborne.selenide.CollectionCondition)1 Condition (com.codeborne.selenide.Condition)1 Condition.hasText (com.codeborne.selenide.Condition.hasText)1 Condition.or (com.codeborne.selenide.Condition.or)1 Orchestrator (com.sonar.orchestrator.Orchestrator)1 Arrays.asList (java.util.Arrays.asList)1 Collections.singletonList (java.util.Collections.singletonList)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 BeforeClass (org.junit.BeforeClass)1 ClassRule (org.junit.ClassRule)1 MeasureDto (org.sonar.db.measure.MeasureDto)1 Issues (org.sonarqube.ws.Issues)1 WsComponents (org.sonarqube.ws.WsComponents)1 WsMeasures (org.sonarqube.ws.WsMeasures)1 WsClient (org.sonarqube.ws.client.WsClient)1 TreeWsRequest (org.sonarqube.ws.client.component.TreeWsRequest)1