Search in sources :

Example 11 with SearchWsResponse

use of org.sonarqube.ws.Measures.SearchWsResponse in project sonarqube by SonarSource.

the class SearchActionTest method does_not_return_branch_when_using_db_key.

@Test
public void does_not_return_branch_when_using_db_key() {
    MetricDto coverage = db.measures().insertMetric(m -> m.setValueType(FLOAT.name()));
    ComponentDto project = db.components().insertPrivateProject();
    ComponentDto branch = db.components().insertProjectBranch(project);
    db.measures().insertLiveMeasure(branch, coverage, m -> m.setValue(10d));
    userSession.addProjectPermission(UserRole.USER, project);
    SearchWsResponse result = call(singletonList(branch.getDbKey()), singletonList(coverage.getKey()));
    assertThat(result.getMeasuresList()).isEmpty();
}
Also used : MetricDto(org.sonar.db.metric.MetricDto) ComponentDto(org.sonar.db.component.ComponentDto) SearchWsResponse(org.sonarqube.ws.Measures.SearchWsResponse) Test(org.junit.Test)

Aggregations

SearchWsResponse (org.sonarqube.ws.Measures.SearchWsResponse)11 Test (org.junit.Test)10 ComponentDto (org.sonar.db.component.ComponentDto)10 MetricDto (org.sonar.db.metric.MetricDto)10 Measure (org.sonarqube.ws.Measures.Measure)6 DbSession (org.sonar.db.DbSession)1 Measures (org.sonarqube.ws.Measures)1