use of org.sonar.db.component.ProjectLinkDto in project sonarqube by SonarSource.
the class DeleteActionTest method fail_if_not_project_admin.
@Test
public void fail_if_not_project_admin() {
ComponentDto project = db.components().insertPrivateProject();
ProjectLinkDto link = db.componentLinks().insertCustomLink(project);
userSession.logIn();
assertThatThrownBy(() -> deleteLink(link)).isInstanceOf(ForbiddenException.class);
}
use of org.sonar.db.component.ProjectLinkDto 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));
}
use of org.sonar.db.component.ProjectLinkDto 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()));
}
use of org.sonar.db.component.ProjectLinkDto in project sonarqube by SonarSource.
the class CreateActionTest method createAndTest.
private void createAndTest(ComponentDto project, String name, String url, String type) {
ProjectLinks.CreateWsResponse response = ws.newRequest().setMethod("POST").setParam(PARAM_PROJECT_KEY, project.getDbKey()).setParam(PARAM_NAME, name).setParam(PARAM_URL, url).executeProtobuf(ProjectLinks.CreateWsResponse.class);
String newId = response.getLink().getId();
ProjectLinkDto link = dbClient.projectLinkDao().selectByUuid(dbSession, newId);
assertThat(link.getName()).isEqualTo(name);
assertThat(link.getHref()).isEqualTo(url);
assertThat(link.getType()).isEqualTo(type);
}
use of org.sonar.db.component.ProjectLinkDto 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()));
}
Aggregations