aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-07 17:42:40 +0000
committerGodin <mandrikov@gmail.com>2010-12-07 17:42:40 +0000
commit7fc9f662522fdd85f71b13e307f38a087a86f1ac (patch)
treec045e45badb9f0790bdfdf184b1d46c7ad1f5845
parent7b14f36d5afc4b1a1730307d2dd2b62700b16b59 (diff)
downloadsonarqube-7fc9f662522fdd85f71b13e307f38a087a86f1ac.tar.gz
sonarqube-7fc9f662522fdd85f71b13e307f38a087a86f1ac.zip
SONAR-1829: Use severity instead of priority
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ViolationsDecoratorTest.java8
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewViolationsDecoratorTest.java16
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/AccessorVisitorTest.java7
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/bridges/FunctionComplexityDistributionBridgeTest.java15
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java6
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/checks/checkers/MessageDispatcher.java4
7 files changed, 29 insertions, 29 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ViolationsDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ViolationsDecoratorTest.java
index 866d02d4d19..1abffdfb8f3 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ViolationsDecoratorTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ViolationsDecoratorTest.java
@@ -135,10 +135,10 @@ public class ViolationsDecoratorTest {
private List<Violation> createViolations() {
List<Violation> violations = new ArrayList<Violation>();
- violations.add(Violation.create(ruleA1, resource).setPriority(RulePriority.CRITICAL));
- violations.add(Violation.create(ruleA1, resource).setPriority(RulePriority.CRITICAL));
- violations.add(Violation.create(ruleA2, resource).setPriority(RulePriority.MAJOR));
- violations.add(Violation.create(ruleB1, resource).setPriority(RulePriority.MINOR));
+ violations.add(Violation.create(ruleA1, resource).setSeverity(RulePriority.CRITICAL));
+ violations.add(Violation.create(ruleA1, resource).setSeverity(RulePriority.CRITICAL));
+ violations.add(Violation.create(ruleA2, resource).setSeverity(RulePriority.MAJOR));
+ violations.add(Violation.create(ruleB1, resource).setSeverity(RulePriority.MINOR));
return violations;
}
}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewViolationsDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewViolationsDecoratorTest.java
index dca4168ca45..2fd987589aa 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewViolationsDecoratorTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewViolationsDecoratorTest.java
@@ -125,8 +125,8 @@ public class NewViolationsDecoratorTest {
@Test
public void shouldClearCacheAfterExecution() {
- Violation violation1 = Violation.create(rule1, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(rightNow);
- Violation violation2 = Violation.create(rule2, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(rightNow);
+ Violation violation1 = Violation.create(rule1, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(rightNow);
+ Violation violation2 = Violation.create(rule2, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(rightNow);
when(context.getViolations()).thenReturn(Arrays.asList(violation1)).thenReturn(Arrays.asList(violation2));
decorator.decorate(resource, context);
@@ -162,12 +162,12 @@ public class NewViolationsDecoratorTest {
private List<Violation> createViolations() {
List<Violation> violations = new ArrayList<Violation>();
- violations.add(Violation.create(rule1, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(rightNow));
- violations.add(Violation.create(rule1, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(tenDaysAgo));
- violations.add(Violation.create(rule2, resource).setPriority(RulePriority.MAJOR).setCreatedAt(fiveDaysAgo));
- violations.add(Violation.create(rule2, resource).setPriority(RulePriority.MAJOR).setCreatedAt(tenDaysAgo));
- violations.add(Violation.create(rule3, resource).setPriority(RulePriority.MINOR).setCreatedAt(fiveDaysAgo));
- violations.add(Violation.create(rule3, resource).setPriority(RulePriority.MINOR).setCreatedAt(tenDaysAgo));
+ violations.add(Violation.create(rule1, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(rightNow));
+ violations.add(Violation.create(rule1, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(tenDaysAgo));
+ violations.add(Violation.create(rule2, resource).setSeverity(RulePriority.MAJOR).setCreatedAt(fiveDaysAgo));
+ violations.add(Violation.create(rule2, resource).setSeverity(RulePriority.MAJOR).setCreatedAt(tenDaysAgo));
+ violations.add(Violation.create(rule3, resource).setSeverity(RulePriority.MINOR).setCreatedAt(fiveDaysAgo));
+ violations.add(Violation.create(rule3, resource).setSeverity(RulePriority.MINOR).setCreatedAt(tenDaysAgo));
return violations;
}
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/AccessorVisitorTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/AccessorVisitorTest.java
index c5cf6852919..9295075d836 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/AccessorVisitorTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/AccessorVisitorTest.java
@@ -19,17 +19,16 @@
*/
package org.sonar.java.ast.visitor;
-import static org.junit.Assert.assertEquals;
-import static org.sonar.java.ast.SquidTestUtils.getFile;
-
import org.junit.Test;
import org.sonar.java.ast.JavaAstScanner;
import org.sonar.java.squid.JavaSquidConfiguration;
import org.sonar.squid.Squid;
import org.sonar.squid.api.SourceCode;
-import org.sonar.squid.api.SquidConfiguration;
import org.sonar.squid.measures.Metric;
+import static org.junit.Assert.assertEquals;
+import static org.sonar.java.ast.SquidTestUtils.getFile;
+
public class AccessorVisitorTest {
private Squid squid;
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/bridges/FunctionComplexityDistributionBridgeTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/bridges/FunctionComplexityDistributionBridgeTest.java
index 9b78844f544..d5203779f6a 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/bridges/FunctionComplexityDistributionBridgeTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/bridges/FunctionComplexityDistributionBridgeTest.java
@@ -21,17 +21,18 @@
package org.sonar.plugins.squid.bridges;
import org.junit.Test;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.never;
-import static org.mockito.Matchers.*;
-import org.sonar.api.resources.JavaPackage;
-import org.sonar.api.resources.JavaFile;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
+import org.sonar.api.resources.JavaFile;
+import org.sonar.api.resources.JavaPackage;
import org.sonar.api.test.IsMeasure;
-import static org.hamcrest.Matchers.any;
-public class FunctionComplexityDistributionBridgeTest extends BridgeTestCase{
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+public class FunctionComplexityDistributionBridgeTest extends BridgeTestCase {
@Test
public void functionComplexityDistribution() {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java
index 324f8f0f01b..8f7a9f1e872 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java
@@ -404,7 +404,7 @@ public final class DefaultIndex extends SonarIndex {
}
} else {
- violation.setPriority(activeRule.getSeverity());
+ violation.setSeverity(activeRule.getSeverity());
doAddViolation(violation, bucket);
}
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java
index a0d4ae27679..f9bd575af86 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java
@@ -59,12 +59,12 @@ public class ViolationPersisterTest extends AbstractDbUnitTestCase {
@Test
public void shouldSaveViolations() {
Violation violation1a = Violation.create(rule1, javaFile)
- .setPriority(RulePriority.CRITICAL).setLineId(20).setCost(55.6)
+ .setSeverity(RulePriority.CRITICAL).setLineId(20).setCost(55.6)
.setMessage("the message");
Violation violation1b = Violation.create(rule1, javaFile)
- .setPriority(RulePriority.CRITICAL).setLineId(50).setCost(80.0);
+ .setSeverity(RulePriority.CRITICAL).setLineId(50).setCost(80.0);
Violation violation2 = Violation.create(rule2, javaFile)
- .setPriority(RulePriority.MINOR);
+ .setSeverity(RulePriority.MINOR);
Project project = new Project("project");
violationPersister.saveViolation(project, violation1a);
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/checkers/MessageDispatcher.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/checkers/MessageDispatcher.java
index 47c48f28a66..5885b2f5035 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/checks/checkers/MessageDispatcher.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/checkers/MessageDispatcher.java
@@ -99,7 +99,7 @@ public class MessageDispatcher {
Violation violation = Violation.create(new Rule(check.getRepositoryKey(), check.getTemplateKey()), resource);
violation.setLineId(message.getLine());
violation.setMessage(message.getText(Locale.ENGLISH));
- violation.setPriority(RulePriority.fromCheckPriority(check.getPriority()));
+ violation.setSeverity(RulePriority.fromCheckPriority(check.getPriority()));
context.saveViolation(violation);
}
@@ -108,4 +108,4 @@ public class MessageDispatcher {
checksByChecker.clear();
}
-} \ No newline at end of file
+}