]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2137: Fix updating of past violations
authorEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 1 Feb 2011 20:57:10 +0000 (23:57 +0300)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 1 Feb 2011 21:39:03 +0000 (00:39 +0300)
* Database field rule_failures.failure_level should be updatable

* Change corresponding unit test

sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java
sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldUpdateViolation-result.xml
sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java

index b307e8dbe67109143799e7f5564e7349ee8bf555..55f30b322571a39fb089c340cf0a70120e819423 100644 (file)
@@ -76,7 +76,7 @@ public class ViolationPersisterTest extends AbstractDbUnitTestCase {
   @Test
   public void shouldUpdateViolation() {
     Violation violation = Violation.create(rule1, javaFile)
-        .setLineId(20).setCost(55.6);
+        .setLineId(20).setCost(55.6).setSeverity(RulePriority.MINOR);
     RuleFailureModel model = getSession().getSingleResult(RuleFailureModel.class, "id", 1);
 
     violationPersister.saveOrUpdateViolation(new Project("project"), violation, model, null);
index 816cb6a6edc3c86a591f6140a737370be187facb..b54b33d0fe27205e3fa8f7c036bd7f45d3afe4b2 100644 (file)
@@ -18,6 +18,6 @@
              scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path=""
              status="U" islast="false" depth="3" />
 
-  <RULE_FAILURES ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="20" COST="55.6" created_at="2008-11-01 13:58:00.00" checksum="[null]"/>
+  <RULE_FAILURES ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="1" MESSAGE="old message" LINE="20" COST="55.6" created_at="2008-11-01 13:58:00.00" checksum="[null]"/>
   <RULE_FAILURES ID="2" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/>
 </dataset>
index f47f8b724c55e406b0d3cf4a391706043902a51e..66a7ccb317284cd97e4670d9857c76d785403849 100644 (file)
@@ -42,7 +42,7 @@ public class RuleFailureModel extends BaseIdentifiable {
   @Column(name = "rule_id", updatable = false, nullable = false)
   private Integer ruleId;
 
-  @Column(name = "failure_level", updatable = false, nullable = false)
+  @Column(name = "failure_level", updatable = true, nullable = false)
   @Enumerated(EnumType.ORDINAL)
   private RulePriority priority;