Search in sources :

Example 11 with ComponentWsResponse

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

the class ComponentActionTest method reference_key_in_the_response.

@Test
public void reference_key_in_the_response() {
    userSession.logIn().setRoot();
    ComponentDto project = db.components().insertPrivateProject();
    ComponentDto view = db.components().insertPrivatePortfolio();
    db.components().insertSnapshot(view);
    ComponentDto projectCopy = db.components().insertComponent(newProjectCopy("project-uuid-copy", project, view));
    MetricDto metric = db.measures().insertMetric(m -> m.setValueType("INT"));
    ComponentWsResponse response = newRequest(projectCopy.getKey(), metric.getKey());
    assertThat(response.getComponent().getRefKey()).isEqualTo(project.getKey());
}
Also used : MetricDto(org.sonar.db.metric.MetricDto) ComponentWsResponse(org.sonarqube.ws.Measures.ComponentWsResponse) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Aggregations

ComponentWsResponse (org.sonarqube.ws.Measures.ComponentWsResponse)11 MetricDto (org.sonar.db.metric.MetricDto)10 Test (org.junit.Test)9 ComponentDto (org.sonar.db.component.ComponentDto)9 Measures (org.sonarqube.ws.Measures)5 SnapshotDto (org.sonar.db.component.SnapshotDto)4 Common (org.sonarqube.ws.Common)4 Double.parseDouble (java.lang.Double.parseDouble)3 String.format (java.lang.String.format)3 Function (java.util.function.Function)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)3 Assertions.tuple (org.assertj.core.api.Assertions.tuple)3 Rule (org.junit.Rule)3 WebService (org.sonar.api.server.ws.WebService)3 Param (org.sonar.api.server.ws.WebService.Param)3 DateUtils.parseDateTime (org.sonar.api.utils.DateUtils.parseDateTime)3 System2 (org.sonar.api.utils.System2)3 UserRole (org.sonar.api.web.UserRole)3 USER (org.sonar.api.web.UserRole.USER)3