diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-07 15:03:28 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-07 15:04:56 +0200 |
commit | 93cb18b0a9e9e2ea9613e28d1b1538c7e51ff806 (patch) | |
tree | e58933b660a2f4d15ed8c9c1f07da52e0bc0d150 /sonar-core/src/test | |
parent | 9ac6a6125cf9c67759858223dc65cf8176e849f9 (diff) | |
download | sonarqube-93cb18b0a9e9e2ea9613e28d1b1538c7e51ff806.tar.gz sonarqube-93cb18b0a9e9e2ea9613e28d1b1538c7e51ff806.zip |
SONAR-3755 refactor comments
Diffstat (limited to 'sonar-core/src/test')
21 files changed, 363 insertions, 44 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/ChangeDtoConverterTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/ChangeDtoConverterTest.java index 3868e04c236..e7f5ff2b26c 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/ChangeDtoConverterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/ChangeDtoConverterTest.java @@ -20,20 +20,15 @@ package org.sonar.core.issue.db; import org.junit.Test; -import org.sonar.core.issue.DefaultIssue; +import org.sonar.core.issue.DefaultIssueComment; import org.sonar.core.issue.FieldDiffs; -import org.sonar.core.issue.IssueChangeContext; -import org.sonar.core.issue.IssueComment; - -import java.util.Date; -import java.util.List; import static org.fest.assertions.Assertions.assertThat; public class ChangeDtoConverterTest { @Test public void testToChangeDtos() throws Exception { - IssueComment comment = IssueComment.create("emmerik", "the comment"); + DefaultIssueComment comment = DefaultIssueComment.create("emmerik", "the comment"); IssueChangeDto dto = ChangeDtoConverter.commentToDto("ABCDE", comment); @@ -54,7 +49,7 @@ public class ChangeDtoConverterTest { IssueChangeDto dto = ChangeDtoConverter.changeToDto("ABCDE", diffs); assertThat(dto.getChangeData()).isEqualTo("severity=INFO|BLOCKER"); - assertThat(dto.getChangeType()).isEqualTo("change"); + assertThat(dto.getChangeType()).isEqualTo("diff"); assertThat(dto.getCreatedAt()).isNotNull(); assertThat(dto.getUpdatedAt()).isNotNull(); assertThat(dto.getIssueKey()).isEqualTo("ABCDE"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java index a777e227e79..426ea6b2e14 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java @@ -21,10 +21,14 @@ package org.sonar.core.issue.db; import org.junit.Before; import org.junit.Test; +import org.sonar.api.utils.DateUtils; +import org.sonar.core.issue.DefaultIssueComment; import org.sonar.core.issue.FieldDiffs; -import org.sonar.core.issue.IssueComment; import org.sonar.core.persistence.AbstractDaoTestCase; +import java.util.Arrays; +import java.util.Date; + import static org.fest.assertions.Assertions.assertThat; public class IssueChangeDaoTest extends AbstractDaoTestCase { @@ -32,7 +36,7 @@ public class IssueChangeDaoTest extends AbstractDaoTestCase { IssueChangeDao dao; @Before - public void createDao() { + public void setUp() { dao = new IssueChangeDao(getMyBatis()); } @@ -40,15 +44,18 @@ public class IssueChangeDaoTest extends AbstractDaoTestCase { public void should_select_issue_comments() { setupData("shared"); - IssueComment[] comments = dao.selectIssueComments("1000"); + DefaultIssueComment[] comments = dao.selectIssueComments("1000"); assertThat(comments).hasSize(2); - IssueComment first = comments[0]; - assertThat(first.text()).isEqualTo("recent comment"); - assertThat(first.userLogin()).isEqualTo("arthur"); - assertThat(first.key()).isEqualTo("FGHIJ"); - IssueComment second = comments[1]; - assertThat(second.text()).isEqualTo("old comment"); + // chronological order + DefaultIssueComment first = comments[0]; + assertThat(first.text()).isEqualTo("old comment"); + + + DefaultIssueComment second = comments[1]; + assertThat(second.userLogin()).isEqualTo("arthur"); + assertThat(second.key()).isEqualTo("FGHIJ"); + assertThat(second.text()).isEqualTo("recent comment"); } @Test diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java new file mode 100644 index 00000000000..9c320bf12cd --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java @@ -0,0 +1,73 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.core.issue.db; + +import org.apache.ibatis.session.SqlSession; +import org.junit.Before; +import org.junit.Test; +import org.sonar.api.utils.DateUtils; +import org.sonar.core.persistence.AbstractDaoTestCase; + +import java.util.Date; + +public class IssueChangeMapperTest extends AbstractDaoTestCase { + SqlSession session; + IssueChangeMapper mapper; + + @Before + public void setUp() { + session = getMyBatis().openSession(); + mapper = session.getMapper(IssueChangeMapper.class); + } + + @Test + public void testInsertDiff() throws Exception { + IssueChangeDto dto = new IssueChangeDto(); + dto.setKey(null /* no key on field changes */); + dto.setUserLogin("emmerik"); + dto.setIssueKey("ABCDE"); + dto.setChangeType(ChangeDtoConverter.TYPE_FIELD_CHANGE); + dto.setChangeData("severity=INFO|BLOCKER"); + Date d = DateUtils.parseDate("2013-05-18"); + dto.setCreatedAt(d); + dto.setUpdatedAt(d); + mapper.insert(dto); + session.commit(); + + checkTables("testInsertDiff", new String[]{"id"}, "issue_changes"); + } + + @Test + public void testInsertComment() throws Exception { + IssueChangeDto dto = new IssueChangeDto(); + dto.setKey("COMMENT-1234"); + dto.setUserLogin("emmerik"); + dto.setIssueKey("ABCDE"); + dto.setChangeType(ChangeDtoConverter.TYPE_COMMENT); + dto.setChangeData("the comment"); + Date d = DateUtils.parseDate("2013-05-18"); + dto.setCreatedAt(d); + dto.setUpdatedAt(d); + mapper.insert(dto); + session.commit(); + + checkTables("testInsertComment", new String[]{"id"}, "issue_changes"); + } +} diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java index a8ddecf4c49..0d35a9b5327 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java @@ -48,9 +48,8 @@ public class IssueDaoTest extends AbstractDaoTestCase { setupData("shared", "should_select_by_key"); IssueDto issue = dao.selectByKey("ABCDE"); - assertThat(issue.getKey()).isEqualTo("ABCDE"); + assertThat(issue.getKee()).isEqualTo("ABCDE"); assertThat(issue.getId()).isEqualTo(100L); - assertThat(issue.getKey()).isEqualTo("ABCDE"); assertThat(issue.getResourceId()).isEqualTo(400); assertThat(issue.getRuleId()).isEqualTo(500); assertThat(issue.getSeverity()).isEqualTo("BLOCKER"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java index 539229136ab..54be128bc42 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java @@ -54,7 +54,7 @@ public class IssueDtoTest { Date closedAt = DateUtils.addDays(new Date(), -1); IssueDto dto = new IssueDto() - .setKey("100") + .setKee("100") .setRuleId(1) .setRuleKey_unit_test_only("squid", "AvoidCycle") .setComponentKey_unit_test_only("component-key") diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java new file mode 100644 index 00000000000..b7e1513678c --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java @@ -0,0 +1,102 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.core.issue.db; + +import org.apache.ibatis.session.SqlSession; +import org.junit.Before; +import org.junit.Test; +import org.sonar.api.utils.DateUtils; +import org.sonar.core.persistence.AbstractDaoTestCase; + +public class IssueMapperTest extends AbstractDaoTestCase { + + SqlSession session; + IssueMapper mapper; + + @Before + public void setUp() { + session = getMyBatis().openSession(); + mapper = session.getMapper(IssueMapper.class); + } + + @Test + public void testInsert() throws Exception { + IssueDto dto = new IssueDto(); + dto.setResourceId(123); + dto.setRuleId(200); + dto.setKee("ABCDE"); + dto.setLine(500); + dto.setEffortToFix(3.14); + dto.setResolution("FIXED"); + dto.setStatus("RESOLVED"); + dto.setSeverity("BLOCKER"); + dto.setUserLogin("emmerik"); + dto.setAuthorLogin("morgan"); + dto.setAssignee("karadoc"); + dto.setActionPlanKey("current_sprint"); + dto.setAttributes("JIRA=FOO-1234"); + dto.setChecksum("123456789"); + dto.setDescription("the description"); + + dto.setIssueCreationDate(DateUtils.parseDate("2013-05-18")); + dto.setIssueUpdateDate(DateUtils.parseDate("2013-05-19")); + dto.setIssueCloseDate(DateUtils.parseDate("2013-05-20")); + dto.setCreatedAt(DateUtils.parseDate("2013-05-21")); + dto.setUpdatedAt(DateUtils.parseDate("2013-05-22")); + + mapper.insert(dto); + session.commit(); + + checkTables("testInsert", new String[]{"id"}, "issues"); + } + + @Test + public void testUpdate() throws Exception { + setupData("testUpdate"); + + IssueDto dto = new IssueDto(); + dto.setResourceId(123); + dto.setRuleId(200); + dto.setKee("ABCDE"); + dto.setLine(500); + dto.setEffortToFix(3.14); + dto.setResolution("FIXED"); + dto.setStatus("RESOLVED"); + dto.setSeverity("BLOCKER"); + dto.setUserLogin("emmerik"); + dto.setAuthorLogin("morgan"); + dto.setAssignee("karadoc"); + dto.setActionPlanKey("current_sprint"); + dto.setAttributes("JIRA=FOO-1234"); + dto.setChecksum("123456789"); + dto.setDescription("the description"); + + dto.setIssueCreationDate(DateUtils.parseDate("2013-05-18")); + dto.setIssueUpdateDate(DateUtils.parseDate("2013-05-19")); + dto.setIssueCloseDate(DateUtils.parseDate("2013-05-20")); + dto.setCreatedAt(DateUtils.parseDate("2013-05-21")); + dto.setUpdatedAt(DateUtils.parseDate("2013-05-22")); + + mapper.update(dto); + session.commit(); + + checkTables("testUpdate", new String[]{"id"}, "issues"); + } +} diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java index edf5cb15856..1aa38f19657 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java @@ -26,8 +26,8 @@ import org.sonar.api.rules.RuleFinder; import org.sonar.api.rules.RuleQuery; import org.sonar.api.utils.DateUtils; import org.sonar.core.issue.DefaultIssue; +import org.sonar.core.issue.DefaultIssueComment; import org.sonar.core.issue.IssueChangeContext; -import org.sonar.core.issue.IssueComment; import org.sonar.core.persistence.AbstractDaoTestCase; import org.sonar.core.persistence.MyBatis; @@ -42,7 +42,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { public void should_insert_new_issues() throws Exception { FakeSaver saver = new FakeSaver(getMyBatis(), new FakeRuleFinder()); - IssueComment comment = IssueComment.create("emmerik", "the comment"); + DefaultIssueComment comment = DefaultIssueComment.create("emmerik", "the comment"); // override generated key comment.setKey("FGHIJ"); @@ -71,7 +71,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { FakeSaver saver = new FakeSaver(getMyBatis(), new FakeRuleFinder()); - IssueComment comment = IssueComment.create("emmerik", "the comment"); + DefaultIssueComment comment = DefaultIssueComment.create("emmerik", "the comment"); // override generated key comment.setKey("FGHIJ"); diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeDaoTest/shared.xml index e9d0022f889..ae1bcb0b328 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeDaoTest/shared.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeDaoTest/shared.xml @@ -16,7 +16,7 @@ kee="[null]" issue_key="1000" user_login="arthur" - change_type="change" + change_type="diff" change_data="severity=MAJOR|BLOCKER" created_at="2013-02-02" updated_at="2013-02-02" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeMapperTest/testInsertComment-result.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeMapperTest/testInsertComment-result.xml new file mode 100644 index 00000000000..c1f10296b62 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeMapperTest/testInsertComment-result.xml @@ -0,0 +1,12 @@ +<dataset> + <issue_changes + id="1" + kee="COMMENT-1234" + issue_key="ABCDE" + user_login="emmerik" + change_type="comment" + change_data="the comment" + created_at="2013-05-18" + updated_at="2013-05-18" + /> +</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeMapperTest/testInsertDiff-result.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeMapperTest/testInsertDiff-result.xml new file mode 100644 index 00000000000..4d7045179e9 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueChangeMapperTest/testInsertDiff-result.xml @@ -0,0 +1,12 @@ +<dataset> + <issue_changes + id="1" + kee="[null]" + issue_key="ABCDE" + user_login="emmerik" + change_type="diff" + change_data="severity=INFO|BLOCKER" + created_at="2013-05-18" + updated_at="2013-05-18" + /> +</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_all.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_all.xml index 285456d07fe..b4bd5440f19 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_all.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_all.xml @@ -3,7 +3,7 @@ <!-- rule 500 --> <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -28,7 +28,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" @@ -55,7 +55,7 @@ <!-- rule 501 --> <issues id="102" - kee="ABCDE" + kee="ABCDE-3" resource_id="400" rule_id="501" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_assigned.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_assigned.xml index e09cf89e7a8..11a1b1e6c0b 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_assigned.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_assigned.xml @@ -3,7 +3,7 @@ <!-- rule 500 --> <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -28,7 +28,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" @@ -55,7 +55,7 @@ <!-- rule 501 --> <issues id="102" - kee="ABCDE" + kee="ABCDE-3" resource_id="400" rule_id="501" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_date_creation.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_date_creation.xml index dc3dce23a04..79562aa6c38 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_date_creation.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_date_creation.xml @@ -2,7 +2,7 @@ <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -27,7 +27,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_ids.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_ids.xml index 285456d07fe..b96e48f1db9 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_ids.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_ids.xml @@ -3,7 +3,7 @@ <!-- rule 500 --> <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -28,7 +28,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_rules.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_rules.xml index 9fbab6fea10..1c355d2a550 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_rules.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_by_rules.xml @@ -3,7 +3,7 @@ <!-- rule 500 --> <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -28,7 +28,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" @@ -55,7 +55,7 @@ <!-- rule 501 --> <issues id="102" - kee="ABCDE" + kee="ABCDE-3" resource_id="400" rule_id="501" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_issue_ids_and_components_ids.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_issue_ids_and_components_ids.xml index 285456d07fe..b4bd5440f19 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_issue_ids_and_components_ids.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_issue_ids_and_components_ids.xml @@ -3,7 +3,7 @@ <!-- rule 500 --> <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -28,7 +28,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" @@ -55,7 +55,7 @@ <!-- rule 501 --> <issues id="102" - kee="ABCDE" + kee="ABCDE-3" resource_id="400" rule_id="501" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_returned_sorted_result.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_returned_sorted_result.xml index f6d9e75ea16..7c3272bc171 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_returned_sorted_result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueDaoTest/should_select_returned_sorted_result.xml @@ -3,7 +3,7 @@ <!-- rule 500 --> <issues id="100" - kee="ABCDE" + kee="ABCDE-1" resource_id="400" rule_id="500" severity="BLOCKER" @@ -28,7 +28,7 @@ <issues id="101" - kee="ABCDE" + kee="ABCDE-2" resource_id="400" rule_id="500" severity="BLOCKER" @@ -55,7 +55,7 @@ <!-- rule 501 --> <issues id="102" - kee="ABCDE" + kee="ABCDE-3" resource_id="400" rule_id="501" severity="BLOCKER" diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testInsert-result.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testInsert-result.xml new file mode 100644 index 00000000000..87f0a290699 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testInsert-result.xml @@ -0,0 +1,27 @@ +<dataset> + <issues + id="100" + kee="ABCDE" + resource_id="123" + rule_id="200" + severity="BLOCKER" + manual_severity="[false]" + manual_issue="[false]" + description="the description" + line="500" + effort_to_fix="3.14" + status="RESOLVED" + resolution="FIXED" + checksum="123456789" + user_login="emmerik" + author_login="morgan" + assignee_login="karadoc" + attributes="JIRA=FOO-1234" + issue_creation_date="2013-05-18" + issue_update_date="2013-05-19" + issue_close_date="2013-05-20" + created_at="2013-05-21" + updated_at="2013-05-22" + action_plan_key="current_sprint" + /> +</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate-result.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate-result.xml new file mode 100644 index 00000000000..9385a08792c --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate-result.xml @@ -0,0 +1,46 @@ +<!-- + ~ SonarQube, open source software quality management tool. + ~ Copyright (C) 2008-2013 SonarSource + ~ mailto:contact AT sonarsource DOT com + ~ + ~ SonarQube is free software; you can redistribute it and/or + ~ modify it under the terms of the GNU Lesser General Public + ~ License as published by the Free Software Foundation; either + ~ version 3 of the License, or (at your option) any later version. + ~ + ~ SonarQube is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + ~ Lesser General Public License for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public License + ~ along with this program; if not, write to the Free Software Foundation, + ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + --> +<dataset> + <issues + id="100" + kee="ABCDE" + resource_id="123" + rule_id="200" + severity="BLOCKER" + manual_severity="[false]" + manual_issue="[false]" + description="the description" + line="500" + effort_to_fix="3.14" + status="RESOLVED" + resolution="FIXED" + checksum="123456789" + user_login="emmerik" + author_login="morgan" + assignee_login="karadoc" + attributes="JIRA=FOO-1234" + issue_creation_date="2013-05-18" + issue_update_date="2013-05-19" + issue_close_date="2013-05-20" + created_at="2013-05-21" + updated_at="2013-05-22" + action_plan_key="current_sprint" + /> +</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate.xml new file mode 100644 index 00000000000..38b64d7f53d --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueMapperTest/testUpdate.xml @@ -0,0 +1,46 @@ +<!-- + ~ SonarQube, open source software quality management tool. + ~ Copyright (C) 2008-2013 SonarSource + ~ mailto:contact AT sonarsource DOT com + ~ + ~ SonarQube is free software; you can redistribute it and/or + ~ modify it under the terms of the GNU Lesser General Public + ~ License as published by the Free Software Foundation; either + ~ version 3 of the License, or (at your option) any later version. + ~ + ~ SonarQube is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + ~ Lesser General Public License for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public License + ~ along with this program; if not, write to the Free Software Foundation, + ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + --> +<dataset> + <issues + id="100" + kee="ABCDE" + resource_id="123" + rule_id="200" + severity="INFO" + manual_severity="[false]" + manual_issue="[false]" + description="old" + line="[null]" + effort_to_fix="[null]" + status="OPEN" + resolution="[null]" + checksum="[null]" + user_login="[null]" + author_login="[null]" + assignee_login="[null]" + attributes="[null]" + issue_creation_date="[null]" + issue_update_date="[null]" + issue_close_date="[null]" + created_at="[null]" + updated_at="[null]" + action_plan_key="[null]" + /> +</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_update_issues-result.xml b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_update_issues-result.xml index 6328fa6f38c..5d67bd4602f 100644 --- a/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_update_issues-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/issue/db/IssueStorageTest/should_update_issues-result.xml @@ -26,6 +26,6 @@ <issue_changes id="1" kee="FGHIJ" issue_key="ABCDE" change_type="comment" user_login="emmerik" change_data="the comment" created_at="[null]" updated_at="[null]"/> - <issue_changes id="2" kee="[null]" issue_key="ABCDE" change_type="change" user_login="emmerik" + <issue_changes id="2" kee="[null]" issue_key="ABCDE" change_type="diff" user_login="emmerik" change_data="severity=INFO|BLOCKER" created_at="[null]" updated_at="[null]"/> </dataset>
\ No newline at end of file |