Search in sources :

Example 16 with ComponentLinkDto

use of org.sonar.db.component.ComponentLinkDto in project sonarqube by SonarSource.

the class DeleteActionTest method fail_if_anonymous.

@Test
public void fail_if_anonymous() {
    userSession.anonymous();
    ComponentDto project = insertProject();
    ComponentLinkDto link = insertCustomLink(project.uuid());
    expectedException.expect(ForbiddenException.class);
    deleteLink(link.getId());
}
Also used : ComponentLinkDto(org.sonar.db.component.ComponentLinkDto) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Example 17 with ComponentLinkDto

use of org.sonar.db.component.ComponentLinkDto 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() throws IOException {
    ComponentDto project = db.components().insertProject();
    ComponentLinkDto foo = new ComponentLinkDto().setComponentUuid(project.uuid()).setHref("foo").setType("type");
    insertLink(foo);
    logInAsProjectAdministrator(project);
    callByKey(project.key());
}
Also used : ComponentLinkDto(org.sonar.db.component.ComponentLinkDto) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Example 18 with ComponentLinkDto

use of org.sonar.db.component.ComponentLinkDto in project sonarqube by SonarSource.

the class SearchActionTest method request_does_not_fail_when_link_has_no_type.

@Test
public void request_does_not_fail_when_link_has_no_type() throws IOException {
    ComponentDto project = db.components().insertProject();
    ComponentLinkDto foo = new ComponentLinkDto().setComponentUuid(project.uuid()).setHref("foo").setName("name");
    insertLink(foo);
    logInAsProjectAdministrator(project);
    callByKey(project.key());
}
Also used : ComponentLinkDto(org.sonar.db.component.ComponentLinkDto) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Example 19 with ComponentLinkDto

use of org.sonar.db.component.ComponentLinkDto in project sonarqube by SonarSource.

the class SearchActionTest method insertCustomLink.

private ComponentLinkDto insertCustomLink(String projectUuid) {
    ComponentLinkDto link = new ComponentLinkDto().setComponentUuid(projectUuid).setName("Custom").setType("Custom").setHref("http://example.org/custom");
    insertLink(link);
    return link;
}
Also used : ComponentLinkDto(org.sonar.db.component.ComponentLinkDto)

Example 20 with ComponentLinkDto

use of org.sonar.db.component.ComponentLinkDto in project sonarqube by SonarSource.

the class SearchActionTest method insertHomepageLink.

private ComponentLinkDto insertHomepageLink(String projectUuid) {
    ComponentLinkDto link = new ComponentLinkDto().setComponentUuid(projectUuid).setName("Homepage").setType("homepage").setHref("http://example.org");
    insertLink(link);
    return link;
}
Also used : ComponentLinkDto(org.sonar.db.component.ComponentLinkDto)

Aggregations

ComponentLinkDto (org.sonar.db.component.ComponentLinkDto)20 ComponentDto (org.sonar.db.component.ComponentDto)14 Test (org.junit.Test)11 DbSession (org.sonar.db.DbSession)3 SnapshotDto (org.sonar.db.component.SnapshotDto)2 SearchWsResponse (org.sonarqube.ws.WsProjectLinks.SearchWsResponse)2 InputStream (java.io.InputStream)1 MeasureDto (org.sonar.db.measure.MeasureDto)1 MeasureQuery (org.sonar.db.measure.MeasureQuery)1 MetricDto (org.sonar.db.metric.MetricDto)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1 TestResponse (org.sonar.server.ws.TestResponse)1 WsProjectLinks (org.sonarqube.ws.WsProjectLinks)1