Browse Source

SONAR-3248 add unit tests and fix deletion of review comments

tags/2.14
Simon Brandhof 12 years ago
parent
commit
4b0854c3e6

+ 1
- 1
sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java View File

@@ -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);

+ 24
- 0
sonar-core/src/main/java/org/sonar/core/purge/package-info.java View File

@@ -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;


+ 1
- 1
sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java View File

@@ -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

+ 1
- 0
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml View File

@@ -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"

+ 6
- 0
sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteResource.xml View File

@@ -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>

Loading…
Cancel
Save