Search in sources :

Example 11 with IssueDto

use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.

the class ActionFinderTest method doest_not_return_assign_to_me_action_when_issue_already_assigned_to_user.

@Test
public void doest_not_return_assign_to_me_action_when_issue_already_assigned_to_user() {
    userSession.logIn("julien");
    IssueDto issue = newDto(newXooX1().setId(10), newFileDto(project, null), project).setKee(ISSUE_KEY).setAssignee("julien");
    assertThat(underTest.listAvailableActions(issue)).doesNotContain("assign_to_me");
}
Also used : IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Example 12 with IssueDto

use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.

the class IssueFinderTest method fail_when_issue_key_does_not_exist.

@Test
public void fail_when_issue_key_does_not_exist() throws Exception {
    IssueDto issueDto = insertIssue();
    userSession.addProjectUuidPermissions(USER, issueDto.getProjectUuid());
    expectedException.expect(NotFoundException.class);
    expectedException.expectMessage("Issue with key 'UNKNOWN' does not exist");
    underTest.getByKey(db.getSession(), "UNKNOWN");
}
Also used : IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Example 13 with IssueDto

use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.

the class IssueFinderTest method fail_when_not_enough_permission.

@Test
public void fail_when_not_enough_permission() throws Exception {
    IssueDto issueDto = insertIssue();
    userSession.addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
    expectedException.expect(ForbiddenException.class);
    underTest.getByKey(db.getSession(), issueDto.getKey());
}
Also used : IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Example 14 with IssueDto

use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.

the class IssueUpdaterTest method update_issue.

@Test
public void update_issue() throws Exception {
    DefaultIssue issue = issueDbTester.insertIssue(newIssue().setSeverity(MAJOR)).toDefaultIssue();
    IssueChangeContext context = IssueChangeContext.createUser(new Date(), "john");
    issueFieldsSetter.setSeverity(issue, BLOCKER, context);
    underTest.saveIssue(dbTester.getSession(), issue, context, null);
    IssueDto issueReloaded = dbClient.issueDao().selectByKey(dbTester.getSession(), issue.key()).get();
    assertThat(issueReloaded.getSeverity()).isEqualTo(BLOCKER);
}
Also used : IssueChangeContext(org.sonar.core.issue.IssueChangeContext) IssueDto(org.sonar.db.issue.IssueDto) DefaultIssue(org.sonar.core.issue.DefaultIssue) Date(java.util.Date) Test(org.junit.Test)

Example 15 with IssueDto

use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.

the class IssuesFinderSortTest method should_not_sort_with_null_sort.

@Test
public void should_not_sort_with_null_sort() {
    IssueDto issue1 = new IssueDto().setId(1L).setAssignee("perceval");
    IssueDto issue2 = new IssueDto().setId(2L).setAssignee("arthur");
    IssueDto issue3 = new IssueDto().setId(3L).setAssignee("vincent");
    IssueDto issue4 = new IssueDto().setId(4L).setAssignee(null);
    List<IssueDto> dtoList = newArrayList(issue1, issue2, issue3, issue4);
    IssueQuery query = IssueQuery.builder().sort(null).build();
    IssuesFinderSort issuesFinderSort = new IssuesFinderSort(dtoList, query);
    List<IssueDto> result = newArrayList(issuesFinderSort.sort());
    assertThat(result).hasSize(4);
    assertThat(result.get(0).getAssignee()).isEqualTo("perceval");
    assertThat(result.get(1).getAssignee()).isEqualTo("arthur");
    assertThat(result.get(2).getAssignee()).isEqualTo("vincent");
    assertThat(result.get(3).getAssignee()).isNull();
}
Also used : IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Aggregations

IssueDto (org.sonar.db.issue.IssueDto)134 Test (org.junit.Test)117 ComponentDto (org.sonar.db.component.ComponentDto)48 RuleDto (org.sonar.db.rule.RuleDto)28 IssueIndexer (org.sonar.server.issue.index.IssueIndexer)19 UserDto (org.sonar.db.user.UserDto)18 WsTester (org.sonar.server.ws.WsTester)18 IssueChangeDto (org.sonar.db.issue.IssueChangeDto)15 FieldDiffs (org.sonar.core.issue.FieldDiffs)14 BulkChangeWsResponse (org.sonarqube.ws.Issues.BulkChangeWsResponse)14 ChangelogWsResponse (org.sonarqube.ws.Issues.ChangelogWsResponse)12 TestResponse (org.sonar.server.ws.TestResponse)9 Request (org.sonar.api.server.ws.Request)8 Response (org.sonar.api.server.ws.Response)8 DefaultIssue (org.sonar.core.issue.DefaultIssue)8 UserTesting.newUserDto (org.sonar.db.user.UserTesting.newUserDto)8 TestRequest (org.sonar.server.ws.TestRequest)8 Date (java.util.Date)6 DbSession (org.sonar.db.DbSession)5 IssueDao (org.sonar.db.issue.IssueDao)4