diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-04-25 11:17:09 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-04-25 11:21:03 +0200 |
commit | 7b301db8c7e3000ff2a04fce5534e45e7d973a1f (patch) | |
tree | 6f1092d7cbe3b8ebe38899777200fe3cf715a9b4 /sonar-plugin-api/src/test/java/org/sonar | |
parent | 5a80556a153a2e771920094228ac2e97dd5e7530 (diff) | |
download | sonarqube-7b301db8c7e3000ff2a04fce5534e45e7d973a1f.tar.gz sonarqube-7b301db8c7e3000ff2a04fce5534e45e7d973a1f.zip |
Revert "SONAR-3437, SONAR-5189 Store measures in a persistit cache"
This reverts commit 46395126b184c343df5471a147cdb48133f59f6f.
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasuresFiltersTest.java | 46 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/test/IsRuleMeasure.java | 2 |
2 files changed, 22 insertions, 26 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasuresFiltersTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasuresFiltersTest.java index ea075ed2a99..f9f569f199b 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasuresFiltersTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasuresFiltersTest.java @@ -25,7 +25,6 @@ import org.sonar.api.rules.RulePriority; import java.util.Arrays; import java.util.Collection; -import java.util.Iterator; import java.util.List; import static org.hamcrest.core.Is.is; @@ -38,8 +37,8 @@ public class MeasuresFiltersTest { MeasuresFilter<Measure> filter = MeasuresFilters.metric(CoreMetrics.VIOLATIONS); Collection<Measure> measures = Arrays.asList( - RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 50.0), - new Measure(CoreMetrics.VIOLATIONS, 500.0)); + RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 50.0), + new Measure(CoreMetrics.VIOLATIONS, 500.0)); assertThat(filter.filter(measures).getValue(), is(500.0)); } @@ -47,13 +46,10 @@ public class MeasuresFiltersTest { @Test public void all() { Collection<Measure> measures = Arrays.asList( - RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 50.0), - new Measure(CoreMetrics.VIOLATIONS, 500.0)); + RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 50.0), + new Measure(CoreMetrics.VIOLATIONS, 500.0)); - Iterator<Measure> filteredMeasures = MeasuresFilters.all().filter(measures).iterator(); - filteredMeasures.next(); - filteredMeasures.next(); - assertThat(filteredMeasures.hasNext(), is(false)); + assertThat(MeasuresFilters.all().filter(measures).size(), is(2)); } @Test @@ -62,13 +58,13 @@ public class MeasuresFiltersTest { Rule rule2 = new Rule("pmd", "key2"); MeasuresFilter<RuleMeasure> filter = MeasuresFilters.rule(CoreMetrics.VIOLATIONS, rule1); List<Measure> measures = Arrays.asList( - RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule1, 50.0), - RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule2, 10.0), - RuleMeasure.createForRule(CoreMetrics.VIOLATIONS_DENSITY, rule2, 3.3), + RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule1, 50.0), + RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule2, 10.0), + RuleMeasure.createForRule(CoreMetrics.VIOLATIONS_DENSITY, rule2, 3.3), - RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 400.0), - RuleMeasure.createForPriority(CoreMetrics.COVERAGE, RulePriority.CRITICAL, 400.0), - new Measure(CoreMetrics.VIOLATIONS, 500.0)); + RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 400.0), + RuleMeasure.createForPriority(CoreMetrics.COVERAGE, RulePriority.CRITICAL, 400.0), + new Measure(CoreMetrics.VIOLATIONS, 500.0)); assertThat(filter.filter(measures).getValue(), is(50.0)); } @@ -79,13 +75,13 @@ public class MeasuresFiltersTest { Rule rule2 = new Rule("pmd", "key2"); MeasuresFilter<Collection<RuleMeasure>> filter = MeasuresFilters.rules(CoreMetrics.VIOLATIONS); List<Measure> measures = Arrays.asList( - RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule1, 50.0), - RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule2, 10.0), - RuleMeasure.createForRule(CoreMetrics.VIOLATIONS_DENSITY, rule2, 3.3), + RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule1, 50.0), + RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule2, 10.0), + RuleMeasure.createForRule(CoreMetrics.VIOLATIONS_DENSITY, rule2, 3.3), - RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 400.0), - RuleMeasure.createForPriority(CoreMetrics.COVERAGE, RulePriority.CRITICAL, 400.0), - new Measure(CoreMetrics.VIOLATIONS, 500.0)); + RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 400.0), + RuleMeasure.createForPriority(CoreMetrics.COVERAGE, RulePriority.CRITICAL, 400.0), + new Measure(CoreMetrics.VIOLATIONS, 500.0)); assertThat(filter.filter(measures).size(), is(2)); } @@ -94,10 +90,10 @@ public class MeasuresFiltersTest { public void measure() { MeasuresFilter<Measure> filter = MeasuresFilters.measure(new Measure(CoreMetrics.VIOLATIONS)); List<Measure> measures = Arrays.asList( - new Measure(CoreMetrics.COMMENT_LINES, 50.0), - new Measure(CoreMetrics.VIOLATIONS, 10.0), - RuleMeasure.createForCategory(CoreMetrics.VIOLATIONS, 2, 12.0), - new Measure(CoreMetrics.COVERAGE, 15.0)); + new Measure(CoreMetrics.COMMENT_LINES, 50.0), + new Measure(CoreMetrics.VIOLATIONS, 10.0), + RuleMeasure.createForCategory(CoreMetrics.VIOLATIONS, 2, 12.0), + new Measure(CoreMetrics.COVERAGE, 15.0)); assertThat(filter.filter(measures).getValue(), is(10.0)); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/test/IsRuleMeasure.java b/sonar-plugin-api/src/test/java/org/sonar/api/test/IsRuleMeasure.java index 3f9f67ce236..091d8c781cd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/test/IsRuleMeasure.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/test/IsRuleMeasure.java @@ -46,7 +46,7 @@ public class IsRuleMeasure extends ArgumentMatcher<Measure> { } RuleMeasure m = (RuleMeasure) o; return ObjectUtils.equals(metric, m.getMetric()) && - ObjectUtils.equals(rule.ruleKey(), m.ruleKey()) && + ObjectUtils.equals(rule, m.getRule()) && NumberUtils.compare(value, m.getValue()) == 0; } } |