From: simonbrandhof Date: Tue, 12 Apr 2011 12:46:05 +0000 (+0200) Subject: SONAR-2347 Add the column RULE_FAILURES.PERMANENT_ID X-Git-Tag: 2.8~228 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f3461ab00d488735d61472e95ffedd4429dfa8f3;p=sonarqube.git SONAR-2347 Add the column RULE_FAILURES.PERMANENT_ID --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java index 57460299a54..832a4be13b0 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java @@ -95,12 +95,9 @@ public class ViolationPersisterDecorator implements Decorator { if (pastViolation != null) { // remove violation, since would be updated and shouldn't affect other violations anymore pastViolationsByRule.remove(violation.getRule(), pastViolation); - violation.setCreatedAt(pastViolation.getCreatedAt()); - } else { - violation.setCreatedAt(null);//avoid plugins to set date } String checksum = getChecksumForLine(checksums, violation.getLineId()); - violationPersister.saveViolation(context.getProject(), violation, checksum); + violationPersister.saveViolation(context.getProject(), violation, pastViolation, checksum); } } diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml index 404feaf2e4a..23bec12c6f9 100644 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml +++ b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml @@ -56,10 +56,10 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + --> - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml index 4ca54571036..32696a8a523 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml @@ -19,6 +19,6 @@ scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" status="U" islast="false" depth="3" /> - - + + diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopyPermanentIdFromPastViolation-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopyPermanentIdFromPastViolation-result.xml new file mode 100644 index 00000000000..0b126c584cd --- /dev/null +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopyPermanentIdFromPastViolation-result.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml index ba821ae3153..9a2cbddd9dd 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml @@ -18,9 +18,9 @@ scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" status="U" islast="false" depth="3" /> - - - - - + + + + + \ No newline at end of file diff --git a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/lastSnapshotIsNotUpdatedWhenAnalyzingPastSnapshot-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/lastSnapshotIsNotUpdatedWhenAnalyzingPastSnapshot-result.xml index 95a28818103..a2b0168b563 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/lastSnapshotIsNotUpdatedWhenAnalyzingPastSnapshot-result.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/lastSnapshotIsNotUpdatedWhenAnalyzingPastSnapshot-result.xml @@ -57,13 +57,13 @@ - - - - + + + + - - + + - - - - + + + + - - + + true + add_index 'rule_failures', 'permanent_id', :name => 'rf_permanent_id' + RuleFailure.reset_column_information + end + +end