use of org.sonarqube.ws.WsProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
SearchWsRequest searchWsRequest = toSearchWsRequest(request);
SearchWsResponse searchWsResponse = doHandle(searchWsRequest);
writeProtobuf(searchWsResponse, request, response);
}
use of org.sonarqube.ws.WsProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method checkItWorks.
private void checkItWorks(ComponentDto project) throws IOException {
insertHomepageLink(project.uuid());
SearchWsResponse response = callByKey(project.key());
assertThat(response.getLinksCount()).isEqualTo(1);
assertThat(response.getLinks(0).getName()).isEqualTo("Homepage");
}
use of org.sonarqube.ws.WsProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method response_fields.
@Test
public void response_fields() throws IOException {
ComponentDto project = insertProject();
ComponentLinkDto homepageLink = insertHomepageLink(project.uuid());
ComponentLinkDto customLink = insertCustomLink(project.uuid());
logInAsProjectAdministrator(project);
SearchWsResponse response = callByKey(project.key());
assertThat(response.getLinksCount()).isEqualTo(2);
assertThat(response.getLinksList()).extracting(Link::getId, Link::getName, Link::getType, Link::getUrl).containsOnlyOnce(tuple(homepageLink.getIdAsString(), homepageLink.getName(), homepageLink.getType(), homepageLink.getHref()), tuple(customLink.getIdAsString(), customLink.getName(), customLink.getType(), customLink.getHref()));
}
use of org.sonarqube.ws.WsProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method several_projects.
@Test
public void several_projects() throws IOException {
ComponentDto project1 = insertProject();
ComponentDto project2 = insertProject("another", "abcd");
ComponentLinkDto customLink1 = insertCustomLink(project1.uuid());
insertCustomLink(project2.uuid());
userSession.logIn().setRoot();
SearchWsResponse response = callByKey(project1.key());
assertThat(response.getLinksCount()).isEqualTo(1);
assertThat(response.getLinks(0).getId()).isEqualTo(customLink1.getIdAsString());
}
use of org.sonarqube.ws.WsProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method request_by_project_id.
@Test
public void request_by_project_id() throws IOException {
ComponentDto project = insertProject();
insertHomepageLink(project.uuid());
logInAsProjectAdministrator(project);
SearchWsResponse response = callByUuid(project.uuid());
assertThat(response.getLinksCount()).isEqualTo(1);
assertThat(response.getLinks(0).getName()).isEqualTo("Homepage");
}
Aggregations