use of org.sonarqube.ws.WsMeasures.SearchHistoryResponse in project sonarqube by SonarSource.
the class TimeMachineTest method testHistoryOfIssues.
@Test
public void testHistoryOfIssues() {
SearchHistoryResponse response = searchHistory("blocker_violations", "critical_violations", "info_violations", "major_violations", "minor_violations");
assertThat(response.getPaging().getTotal()).isEqualTo(2);
assertHistory(response, "blocker_violations", "0", "0");
assertHistory(response, "critical_violations", "0", "0");
assertHistory(response, "info_violations", "0", "0");
assertHistory(response, "major_violations", "0", "0");
assertHistory(response, "minor_violations", "26", "43");
}
use of org.sonarqube.ws.WsMeasures.SearchHistoryResponse in project sonarqube by SonarSource.
the class SearchHistoryActionTest method do_not_return_developer_measures.
@Test
public void do_not_return_developer_measures() {
wsRequest.setMetrics(singletonList(complexityMetric.getKey()));
dbClient.measureDao().insert(dbSession, newMeasureDto(complexityMetric, project, analysis).setDeveloperId(42L));
db.commit();
SearchHistoryResponse result = call();
assertThat(result.getMeasuresCount()).isEqualTo(1);
assertThat(result.getMeasures(0).getHistoryCount()).isEqualTo(0);
}
use of org.sonarqube.ws.WsMeasures.SearchHistoryResponse in project sonarqube by SonarSource.
the class TimeMachineTest method testHistoryOfMeasures.
@Test
public void testHistoryOfMeasures() {
SearchHistoryResponse response = searchHistory("lines", "ncloc");
assertThat(response.getPaging().getTotal()).isEqualTo(2);
assertHistory(response, "lines", "26", "43");
assertHistory(response, "ncloc", "24", "40");
}
use of org.sonarqube.ws.WsMeasures.SearchHistoryResponse in project sonarqube by SonarSource.
the class TimeMachineTest method measure_variations_are_only_meaningful_when_additional_fields_contains_periods.
/**
* SONAR-4962
*/
@Test
public void measure_variations_are_only_meaningful_when_additional_fields_contains_periods() {
Map<String, Measure> measures = getMeasuresWithVariationsByMetricKey(orchestrator, PROJECT, "violations", "new_violations");
assertThat(measures.get("violations")).isNotNull();
assertThat(measures.get("new_violations")).isNotNull();
SearchHistoryResponse response = searchHistory("new_violations");
assertThat(response.getMeasures(0).getHistoryCount()).isGreaterThan(0);
measures = getMeasuresByMetricKey(orchestrator, PROJECT, "violations", "new_violations");
assertThat(measures.get("violations")).isNotNull();
assertThat(measures.get("new_violations")).isNull();
}
use of org.sonarqube.ws.WsMeasures.SearchHistoryResponse in project sonarqube by SonarSource.
the class TimeMachineTest method noDataForInterval.
@Test
public void noDataForInterval() {
Date now = new Date();
SearchHistoryResponse response = wsMeasures.searchHistory(SearchHistoryRequest.builder().setComponent(PROJECT).setMetrics(singletonList("lines")).setFrom(formatDate(now)).setTo(formatDate(now)).build());
assertThat(response.getPaging().getTotal()).isEqualTo(0);
assertThat(response.getMeasures(0).getHistoryList()).isEmpty();
}
Aggregations