use of org.sonarqube.ws.client.measure.ComponentTreeWsRequest in project sonarqube by SonarSource.
the class LiteTest method call_measures_ws.
@Test
public void call_measures_ws() {
// project measures
WsMeasures.ComponentWsResponse component = wsClient.measures().component(new ComponentWsRequest().setComponentKey(PROJECT_KEY).setMetricKeys(asList("lines", "ncloc", "files")));
assertThat(component.getComponent().getMeasuresCount()).isEqualTo(3);
// file measures
WsMeasures.ComponentTreeWsResponse tree = wsClient.measures().componentTree(new ComponentTreeWsRequest().setBaseComponentKey(PROJECT_KEY).setQualifiers(singletonList("FIL")).setMetricKeys(asList("lines", "ncloc")));
assertThat(tree.getComponentsCount()).isEqualTo(4);
tree.getComponentsList().forEach(c -> {
assertThat(c.getMeasuresList()).extracting(m -> m.getMetric()).containsOnly("lines", "ncloc");
});
}
Aggregations