use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
SearchRequest searchWsRequest = toSearchWsRequest(request);
SearchWsResponse searchWsResponse = doHandle(searchWsRequest);
writeProtobuf(searchWsResponse, request, response);
}
use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method several_projects.
@Test
public void several_projects() {
ComponentDto project1 = db.components().insertPrivateProject();
ComponentDto project2 = db.components().insertPrivateProject();
ProjectLinkDto link1 = db.componentLinks().insertCustomLink(project1);
ProjectLinkDto link2 = db.componentLinks().insertCustomLink(project2);
userSession.logIn().setRoot();
SearchWsResponse response = callByKey(project1.getKey());
assertThat(response.getLinksList()).extracting(Link::getId, Link::getName).containsExactlyInAnyOrder(tuple(link1.getUuid(), link1.getName()));
}
use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method response_fields.
@Test
public void response_fields() {
ComponentDto project = db.components().insertPrivateProject();
ProjectLinkDto homepageLink = db.componentLinks().insertProvidedLink(project);
ProjectLinkDto customLink = db.componentLinks().insertCustomLink(project);
logInAsProjectAdministrator(project);
SearchWsResponse response = callByKey(project.getKey());
assertThat(response.getLinksList()).extracting(Link::getId, Link::getName, Link::getType, Link::getUrl).containsExactlyInAnyOrder(tuple(homepageLink.getUuid(), "", homepageLink.getType(), homepageLink.getHref()), tuple(customLink.getUuid(), customLink.getName(), customLink.getType(), customLink.getHref()));
}
use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method project_user_can_search_for_links.
@Test
public void project_user_can_search_for_links() {
ComponentDto project = db.components().insertPrivateProject();
ProjectLinkDto link = db.componentLinks().insertCustomLink(project);
userSession.logIn().addProjectPermission(UserRole.USER, project);
SearchWsResponse response = callByKey(project.getKey());
assertThat(response.getLinksList()).extracting(Link::getId, Link::getName).containsExactlyInAnyOrder(tuple(link.getUuid(), link.getName()));
}
use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method request_does_not_fail_when_link_has_no_name.
@Test
public void request_does_not_fail_when_link_has_no_name() {
ComponentDto project = db.components().insertPrivateProject();
ProjectLinkDto link = db.componentLinks().insertProvidedLink(project);
logInAsProjectAdministrator(project);
SearchWsResponse response = callByKey(project.getKey());
assertThat(response.getLinksList()).extracting(Link::getId, Link::hasName).containsExactlyInAnyOrder(tuple(link.getUuid(), false));
}
Aggregations