Search in sources :

Example 6 with SearchWsResponse

use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.

the class SearchActionTest method request_by_project_id.

@Test
public void request_by_project_id() {
    ComponentDto project = db.components().insertPrivateProject();
    ProjectLinkDto link = db.componentLinks().insertCustomLink(project);
    logInAsProjectAdministrator(project);
    SearchWsResponse response = callByUuid(project.uuid());
    assertThat(response.getLinksList()).extracting(Link::getId, Link::getName).containsExactlyInAnyOrder(tuple(link.getUuid(), link.getName()));
}
Also used : ProjectLinkDto(org.sonar.db.component.ProjectLinkDto) ComponentDto(org.sonar.db.component.ComponentDto) SearchWsResponse(org.sonarqube.ws.ProjectLinks.SearchWsResponse) Test(org.junit.Test)

Example 7 with SearchWsResponse

use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.

the class SearchActionTest method project_administrator_can_search_for_links.

@Test
public void project_administrator_can_search_for_links() {
    ComponentDto project = db.components().insertPrivateProject();
    ProjectLinkDto link = db.componentLinks().insertCustomLink(project);
    userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
    SearchWsResponse response = callByKey(project.getKey());
    assertThat(response.getLinksList()).extracting(Link::getId, Link::getName).containsExactlyInAnyOrder(tuple(link.getUuid(), link.getName()));
}
Also used : ProjectLinkDto(org.sonar.db.component.ProjectLinkDto) ComponentDto(org.sonar.db.component.ComponentDto) SearchWsResponse(org.sonarqube.ws.ProjectLinks.SearchWsResponse) Test(org.junit.Test)

Example 8 with SearchWsResponse

use of org.sonarqube.ws.ProjectLinks.SearchWsResponse in project sonarqube by SonarSource.

the class SearchActionTest method request_by_project_key.

@Test
public void request_by_project_key() {
    ComponentDto project = db.components().insertPrivateProject();
    ProjectLinkDto link = db.componentLinks().insertCustomLink(project);
    logInAsProjectAdministrator(project);
    SearchWsResponse response = callByKey(project.getKey());
    assertThat(response.getLinksList()).extracting(Link::getId, Link::getName).containsExactlyInAnyOrder(tuple(link.getUuid(), link.getName()));
}
Also used : ProjectLinkDto(org.sonar.db.component.ProjectLinkDto) ComponentDto(org.sonar.db.component.ComponentDto) SearchWsResponse(org.sonarqube.ws.ProjectLinks.SearchWsResponse) Test(org.junit.Test)

Aggregations

SearchWsResponse (org.sonarqube.ws.ProjectLinks.SearchWsResponse)8 Test (org.junit.Test)7 ComponentDto (org.sonar.db.component.ComponentDto)7 ProjectLinkDto (org.sonar.db.component.ProjectLinkDto)7