Search in sources :

Example 6 with ShowWsResponse

use of org.sonarqube.ws.WsComponents.ShowWsResponse in project sonarqube by SonarSource.

the class ShowActionTest method show_without_ancestors_when_project.

@Test
public void show_without_ancestors_when_project() throws Exception {
    ComponentDto project = componentDb.insertProject();
    componentDb.insertComponent(newModuleDto(project));
    userSession.addProjectUuidPermissions(UserRole.USER, project.uuid());
    ShowWsResponse response = newRequest(null, project.key());
    assertThat(response.getComponent().getKey()).isEqualTo(project.key());
    assertThat(response.getAncestorsList()).isEmpty();
}
Also used : ShowWsResponse(org.sonarqube.ws.WsComponents.ShowWsResponse) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Example 7 with ShowWsResponse

use of org.sonarqube.ws.WsComponents.ShowWsResponse in project sonarqube by SonarSource.

the class ShowActionTest method show_with_last_analysis_date.

@Test
public void show_with_last_analysis_date() throws Exception {
    ComponentDto project = componentDb.insertProject();
    componentDb.insertSnapshot(newAnalysis(project).setCreatedAt(1_000_000_000L).setLast(false));
    componentDb.insertSnapshot(newAnalysis(project).setCreatedAt(2_000_000_000L).setLast(false));
    componentDb.insertSnapshot(newAnalysis(project).setCreatedAt(3_000_000_000L).setLast(true));
    userSession.addProjectUuidPermissions(UserRole.USER, project.uuid());
    ShowWsResponse response = newRequest(null, project.key());
    assertThat(response.getComponent().getAnalysisDate()).isNotEmpty().isEqualTo(formatDateTime(new Date(3_000_000_000L)));
}
Also used : ShowWsResponse(org.sonarqube.ws.WsComponents.ShowWsResponse) ComponentDto(org.sonar.db.component.ComponentDto) Date(java.util.Date) Test(org.junit.Test)

Aggregations

ShowWsResponse (org.sonarqube.ws.WsComponents.ShowWsResponse)7 Test (org.junit.Test)6 ComponentDto (org.sonar.db.component.ComponentDto)4 Date (java.util.Date)2 WsComponents (org.sonarqube.ws.WsComponents)2 ShowWsRequest (org.sonarqube.ws.client.component.ShowWsRequest)1