List of usage examples for org.apache.ibatis.executor.result DefaultResultHandler getResultList
public List<Object> getResultList()
From source file:org.sonar.core.issue.db.IssueChangeDaoTest.java
License:Open Source License
@Test public void select_issue_changelog_by_module() { setupData("select_issue_changelog_by_module"); // 400 is a non-root module, we should find 2 + 1 changelog from classes and one on itself DefaultResultHandler handler = new DefaultResultHandler(); dao.selectChangelogOnNonClosedIssuesByModuleAndType(400, handler); assertThat(handler.getResultList()).hasSize(4); IssueChangeDto issueChangeDto = (IssueChangeDto) handler.getResultList().get(0); assertThat(issueChangeDto.getId()).isNotNull(); assertThat(issueChangeDto.getKey()).isNotNull(); assertThat(issueChangeDto.getIssueKey()).isNotNull(); assertThat(issueChangeDto.getUserLogin()).isNotNull(); assertThat(issueChangeDto.getChangeType()).isNotNull(); assertThat(issueChangeDto.getChangeData()).isNotNull(); assertThat(issueChangeDto.getCreatedAt()).isNotNull(); assertThat(issueChangeDto.getUpdatedAt()).isNotNull(); for (Object changeDtoObject : handler.getResultList()) { IssueChangeDto changeDto = (IssueChangeDto) changeDtoObject; assertThat(changeDto.getChangeType()).isEqualTo(IssueChangeDto.TYPE_FIELD_CHANGE); }/* ww w .ja v a2 s. c o m*/ // 399 is the root module, we should only find 1 changelog on itself handler = new DefaultResultHandler(); dao.selectChangelogOnNonClosedIssuesByModuleAndType(399, handler); assertThat(handler.getResultList()).hasSize(1); }
From source file:org.sonar.core.issue.db.IssueChangeDaoTest.java
License:Open Source License
@Test public void select_issue_changelog_by_module_should_be_sorted_by_creation_date() { setupData("select_issue_changelog_by_module_are_sorted_by_creation_date"); DefaultResultHandler handler = new DefaultResultHandler(); dao.selectChangelogOnNonClosedIssuesByModuleAndType(399, handler); assertThat(handler.getResultList()).hasSize(3); assertThat(((IssueChangeDto) handler.getResultList().get(0)).getId()).isEqualTo(1001); assertThat(((IssueChangeDto) handler.getResultList().get(1)).getId()).isEqualTo(1002); assertThat(((IssueChangeDto) handler.getResultList().get(2)).getId()).isEqualTo(1000); }
From source file:org.sonar.core.issue.db.IssueDaoTest.java
License:Open Source License
@Test public void select_non_closed_issues_by_module() { setupData("shared", "should_select_non_closed_issues_by_module"); // 400 is a non-root module, we should find 2 issues from classes and one on itself DefaultResultHandler handler = new DefaultResultHandler(); dao.selectNonClosedIssuesByModule(400, handler); assertThat(handler.getResultList()).hasSize(3); IssueDto issue = (IssueDto) handler.getResultList().get(0); assertThat(issue.getRuleRepo()).isNotNull(); assertThat(issue.getRule()).isNotNull(); assertThat(issue.getComponentKey()).isNotNull(); assertThat(issue.getProjectKey()).isEqualTo("struts"); // 399 is the root module, we should only find 1 issue on itself handler = new DefaultResultHandler(); dao.selectNonClosedIssuesByModule(399, handler); assertThat(handler.getResultList()).hasSize(1); issue = (IssueDto) handler.getResultList().get(0); assertThat(issue.getComponentKey()).isEqualTo("struts"); assertThat(issue.getProjectKey()).isEqualTo("struts"); }
From source file:org.sonar.core.issue.db.IssueDaoTest.java
License:Open Source License
/** * SONAR-5218//from ww w . j av a2 s.c o m */ @Test public void select_non_closed_issues_by_module_on_removed_project() { // All issues are linked on a project that is not existing anymore setupData("shared", "should_select_non_closed_issues_by_module_on_removed_project"); // 400 is a non-root module, we should find 2 issues from classes and one on itself DefaultResultHandler handler = new DefaultResultHandler(); dao.selectNonClosedIssuesByModule(400, handler); assertThat(handler.getResultList()).hasSize(3); IssueDto issue = (IssueDto) handler.getResultList().get(0); assertThat(issue.getRuleRepo()).isNotNull(); assertThat(issue.getRule()).isNotNull(); assertThat(issue.getComponentKey()).isNotNull(); assertThat(issue.getProjectKey()).isNull(); }
From source file:org.sonar.db.issue.IssueDaoTest.java
License:Open Source License
@Test public void select_non_closed_issues_by_module() { dbTester.prepareDbUnit(getClass(), "shared.xml", "should_select_non_closed_issues_by_module.xml"); // 400 is a non-root module, we should find 2 issues from classes and one on itself DefaultResultHandler handler = new DefaultResultHandler(); underTest.selectNonClosedIssuesByModule(400, handler); assertThat(handler.getResultList()).hasSize(3); IssueDto issue = (IssueDto) handler.getResultList().get(0); assertThat(issue.getRuleRepo()).isNotNull(); assertThat(issue.getRule()).isNotNull(); assertThat(issue.getComponentKey()).isNotNull(); assertThat(issue.getProjectKey()).isEqualTo("struts"); // 399 is the root module, we should only find 1 issue on itself handler = new DefaultResultHandler(); underTest.selectNonClosedIssuesByModule(399, handler); assertThat(handler.getResultList()).hasSize(1); issue = (IssueDto) handler.getResultList().get(0); assertThat(issue.getComponentKey()).isEqualTo("struts"); assertThat(issue.getProjectKey()).isEqualTo("struts"); }
From source file:org.sonar.db.issue.IssueDaoTest.java
License:Open Source License
/** * SONAR-5218//from w w w . j a v a2 s . c o m */ @Test public void select_non_closed_issues_by_module_on_removed_project() { // All issues are linked on a project that is not existing anymore dbTester.prepareDbUnit(getClass(), "shared.xml", "should_select_non_closed_issues_by_module_on_removed_project.xml"); // 400 is a non-root module, we should find 2 issues from classes and one on itself DefaultResultHandler handler = new DefaultResultHandler(); underTest.selectNonClosedIssuesByModule(400, handler); assertThat(handler.getResultList()).hasSize(3); IssueDto issue = (IssueDto) handler.getResultList().get(0); assertThat(issue.getRuleRepo()).isNotNull(); assertThat(issue.getRule()).isNotNull(); assertThat(issue.getComponentKey()).isNotNull(); assertThat(issue.getProjectKey()).isNull(); }
From source file:org.sonar.server.issue.db.IssueDaoTest.java
License:Open Source License
@Test public void select_non_closed_issues_by_module_uuid() { setupData("shared", "select_non_closed_issues_by_module_uuid"); // BCDE is a non-root module, we should find 2 issues from classes and one on itself DefaultResultHandler handler = new DefaultResultHandler(); sut.selectNonClosedIssuesByModuleUuid(session, "BCDE", handler); assertThat(handler.getResultList()).extracting("key").containsOnly("100", "101", "103"); // DBCA is a a simple project with a single file handler = new DefaultResultHandler(); sut.selectNonClosedIssuesByModuleUuid(session, "DBCA", handler); assertThat(handler.getResultList()).hasSize(1); BatchIssueDto batchIssueDto = (BatchIssueDto) handler.getResultList().get(0); assertThat(batchIssueDto.getKey()).isEqualTo("1000"); assertThat(batchIssueDto.getRuleKey()).isEqualTo("AvoidCycle"); assertThat(batchIssueDto.getRuleRepo()).isEqualTo("squid"); assertThat(batchIssueDto.getMessage()).isEqualTo("Avoid this"); assertThat(batchIssueDto.getLine()).isEqualTo(200); assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE); assertThat(batchIssueDto.getStatus()).isEqualTo(Issue.STATUS_RESOLVED); assertThat(batchIssueDto.getSeverity()).isEqualTo(Severity.BLOCKER); assertThat(batchIssueDto.isManualSeverity()).isTrue(); assertThat(batchIssueDto.getComponentKey()).isEqualTo("Sample.java"); assertThat(batchIssueDto.getChecksum()).isEqualTo("123456"); assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john"); assertThat(batchIssueDto.getCreationDate()).isNotNull(); }
From source file:org.sonar.server.issue.db.IssueDaoTest.java
License:Open Source License
@Test public void select_non_closed_issues_by_project_uuid() { setupData("shared", "select_non_closed_issues_by_project_uuid"); // ABCD is the root module, we should find all 4 issues DefaultResultHandler handler = new DefaultResultHandler(); sut.selectNonClosedIssuesByProjectUuid(session, "ABCD", handler); assertThat(handler.getResultList()).hasSize(4); // DBCA is a a simple project with a single file handler = new DefaultResultHandler(); sut.selectNonClosedIssuesByProjectUuid(session, "DBCA", handler); assertThat(handler.getResultList()).hasSize(1); BatchIssueDto batchIssueDto = (BatchIssueDto) handler.getResultList().get(0); assertThat(batchIssueDto.getKey()).isEqualTo("1000"); assertThat(batchIssueDto.getRuleKey()).isEqualTo("AvoidCycle"); assertThat(batchIssueDto.getRuleRepo()).isEqualTo("squid"); assertThat(batchIssueDto.getMessage()).isEqualTo("Avoid this"); assertThat(batchIssueDto.getLine()).isEqualTo(200); assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE); assertThat(batchIssueDto.getStatus()).isEqualTo(Issue.STATUS_RESOLVED); assertThat(batchIssueDto.getSeverity()).isEqualTo(Severity.BLOCKER); assertThat(batchIssueDto.isManualSeverity()).isTrue(); assertThat(batchIssueDto.getComponentKey()).isEqualTo("Sample.java"); assertThat(batchIssueDto.getChecksum()).isEqualTo("123456"); assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john"); assertThat(batchIssueDto.getCreationDate()).isNotNull(); }