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();
}
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)));
}
Aggregations