diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-17 16:26:14 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-17 16:26:45 +0100 |
commit | 4b0854c3e66cd98ab2089c120ea615e9f35c8db9 (patch) | |
tree | 7da0aa534a3c863eee3085bc817e5bf697b04335 | |
parent | 068c6a92d557dd16f220fc0ce7e85d8ce93f323b (diff) | |
download | sonarqube-4b0854c3e66cd98ab2089c120ea615e9f35c8db9.tar.gz sonarqube-4b0854c3e66cd98ab2089c120ea615e9f35c8db9.zip |
SONAR-3248 add unit tests and fix deletion of review comments
5 files changed, 33 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java index 7ebc1f4354d..b448eeb8775 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java @@ -168,9 +168,9 @@ public class PurgeDao { mapper.deleteResourceGroupRoles(resourceId); mapper.deleteResourceUserRoles(resourceId); mapper.deleteResourceManualMeasures(resourceId); - mapper.deleteResourceReviews(resourceId); vendorMapper.deleteResourceReviewComments(resourceId); vendorMapper.deleteResourceActionPlansReviews(resourceId); + mapper.deleteResourceReviews(resourceId); mapper.deleteResourceActionPlans(resourceId); mapper.deleteResourceEvents(resourceId); mapper.deleteResource(resourceId); diff --git a/sonar-core/src/main/java/org/sonar/core/purge/package-info.java b/sonar-core/src/main/java/org/sonar/core/purge/package-info.java new file mode 100644 index 00000000000..ad0e9697ac7 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/purge/package-info.java @@ -0,0 +1,24 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.core.purge; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java index 37bdba4d99a..fbfe4661af2 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java @@ -168,7 +168,7 @@ public class PurgeDaoTest extends DaoTestCase { } finally { MyBatis.closeQuietly(session); } - assertEmptyTables("projects", "snapshots", "events"); + assertEmptyTables("projects", "snapshots", "events", "reviews", "review_comments"); } @Test diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml index e5e94801418..66d6efd5e73 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml @@ -29,6 +29,7 @@ rule_failure_permanent_id="2" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/> + <review_comments id="1" created_at="[null]" updated_at="[null]" review_id="2" user_id="1223" review_text="abc"/> <!-- modules --> <projects id="2" enabled="[true]" root_id="1" diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteResource.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteResource.xml index 1f37f22fa84..df9741558c4 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteResource.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteResource.xml @@ -18,4 +18,10 @@ <events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]" event_date="2008-12-02 13:58:00.00" created_at="[null]"/> + <reviews id="1" project_id="1" resource_id="1" status="CLOSED" + rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" + user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/> + + <review_comments id="1" created_at="[null]" updated_at="[null]" review_id="1" user_id="1223" review_text="abc"/> + </dataset>
\ No newline at end of file |