aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-12-20 10:49:10 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-12-20 10:49:10 +0100
commit4f82d9f2799b1aa639411b923d20cb2e03328c2c (patch)
treee02213cc554dfc752a54e34a4865d68ceb25d63b
parentc616d946b7c6bf390c909823e7d2ebdc228089cb (diff)
downloadsonarqube-4f82d9f2799b1aa639411b923d20cb2e03328c2c.tar.gz
sonarqube-4f82d9f2799b1aa639411b923d20cb2e03328c2c.zip
Fix compatibility of measure filter conditions with SQALE and dev cockpit plugins
-rw-r--r--sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterCondition.java8
-rw-r--r--sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterExecutorTest.java80
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_person_measures.xml44
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml44
5 files changed, 167 insertions, 13 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterCondition.java b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterCondition.java
index a483e0f2b4b..ac4a2c73cce 100644
--- a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterCondition.java
+++ b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterCondition.java
@@ -92,11 +92,17 @@ public class MeasureFilterCondition {
}
StringBuilder appendSqlCondition(StringBuilder sql, int conditionIndex) {
- sql.append(" pmcond").append(conditionIndex).append(".metric_id=");
+ String table = "pmcond" + conditionIndex;
+ sql.append(" ").append(table).append(".metric_id=");
sql.append(metric.getId());
sql.append(" AND ");
appendSqlColumn(sql, conditionIndex);
sql.append(operator.getSql()).append(value);
+ sql.append(" AND ");
+ sql.append(table).append(".rule_id IS NULL AND ");
+ sql.append(table).append(".rule_priority IS NULL AND ");
+ sql.append(table).append(".characteristic_id IS NULL AND ");
+ sql.append(table).append(".person_id IS NULL ");
return sql;
}
diff --git a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java
index 73b5cdb7c74..06a9c9247d3 100644
--- a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterConditionTest.java
@@ -61,7 +61,7 @@ public class MeasureFilterConditionTest {
assertThat(condition.value()).isEqualTo(10.0);
assertThat(condition.appendSqlColumn(new StringBuilder(), 1).toString()).isEqualTo("pmcond1.value");
assertThat(condition.toString()).isNotEmpty();
- assertThat(condition.appendSqlCondition(new StringBuilder(), 1).toString()).isEqualTo(" pmcond1.metric_id=123 AND pmcond1.value>10.0");
+ assertThat(condition.appendSqlCondition(new StringBuilder(), 1).toString()).isEqualTo(" pmcond1.metric_id=123 AND pmcond1.value>10.0 AND pmcond1.rule_id IS NULL AND pmcond1.rule_priority IS NULL AND pmcond1.characteristic_id IS NULL AND pmcond1.person_id IS NULL ");
}
@Test
@@ -77,6 +77,6 @@ public class MeasureFilterConditionTest {
assertThat(condition.value()).isEqualTo(10.0);
assertThat(condition.appendSqlColumn(new StringBuilder(), 2).toString()).isEqualTo("pmcond2.variation_value_3");
assertThat(condition.toString()).isNotEmpty();
- assertThat(condition.appendSqlCondition(new StringBuilder(), 2).toString()).isEqualTo(" pmcond2.metric_id=123 AND pmcond2.variation_value_3<=10.0");
+ assertThat(condition.appendSqlCondition(new StringBuilder(), 2).toString()).isEqualTo(" pmcond2.metric_id=123 AND pmcond2.variation_value_3<=10.0 AND pmcond2.rule_id IS NULL AND pmcond2.rule_priority IS NULL AND pmcond2.characteristic_id IS NULL AND pmcond2.person_id IS NULL ");
}
}
diff --git a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterExecutorTest.java b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterExecutorTest.java
index 4eeab0003ec..61410ca9eae 100644
--- a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterExecutorTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterExecutorTest.java
@@ -53,11 +53,11 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Before
public void before() {
executor = new MeasureFilterExecutor(getMyBatis(), getDatabase(), new ResourceDao(getMyBatis()));
- setupData("shared");
}
@Test
public void should_return_empty_results_if_empty_filter() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter();
assertThat(filter.isEmpty()).isTrue();
@@ -66,6 +66,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void invalid_filter_should_not_return_results() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setUserFavourites(true);
// anonymous user does not have favourites
assertThat(executor.execute(filter, new MeasureFilterContext())).isEmpty();
@@ -73,6 +74,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_is_not_valid_if_missing_base_snapshot() {
+ setupData("shared");
MeasureFilterContext context = new MeasureFilterContext();
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setOnBaseResourceChildren(true);
assertThat(MeasureFilterExecutor.isValid(filter, context)).isFalse();
@@ -83,6 +85,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_is_not_valid_if_condition_on_unknown_metric() {
+ setupData("shared");
MeasureFilterContext context = new MeasureFilterContext();
MeasureFilter filter = new MeasureFilter().addCondition(new MeasureFilterCondition(null, MeasureFilterCondition.Operator.LESS, 3.0));
assertThat(MeasureFilterExecutor.isValid(filter, context)).isFalse();
@@ -90,6 +93,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_is_not_valid_if_sorting_on_unknown_metric() {
+ setupData("shared");
MeasureFilterContext context = new MeasureFilterContext();
MeasureFilter filter = new MeasureFilter().setSortOnMetric(null);
assertThat(MeasureFilterExecutor.isValid(filter, context)).isFalse();
@@ -97,6 +101,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_is_not_valid_if_anonymous_favourites() {
+ setupData("shared");
MeasureFilterContext context = new MeasureFilterContext();
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setUserFavourites(true);
assertThat(MeasureFilterExecutor.isValid(filter, context)).isFalse();
@@ -107,6 +112,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void projects_without_measure_conditions() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortOn(MeasureFilterSort.Field.LANGUAGE);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -117,6 +123,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void test_default_sort() {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA"));
assertThat(filter.sort().isAsc()).isTrue();
@@ -126,6 +133,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_resource_name() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortAsc(true);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -137,6 +145,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_resource_key() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortAsc(true).setSortOn(MeasureFilterSort.Field.KEY);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -148,6 +157,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_resource_version() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortAsc(true).setSortOn(MeasureFilterSort.Field.VERSION);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -159,6 +169,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_descending_resource_name() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortAsc(false);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -170,6 +181,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_text_measure() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortOnMetric(METRIC_PROFILE);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -180,6 +192,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_descending_text_measure() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortOnMetric(METRIC_PROFILE).setSortAsc(false);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -190,6 +203,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_missing_text_measure() throws SQLException {
+ setupData("shared");
// the metric 'profile' is not set on files
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortOnMetric(METRIC_PROFILE);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -199,6 +213,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_numeric_measure() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortOnMetric(METRIC_LINES);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -210,6 +225,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_descending_numeric_measure() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortOnMetric(METRIC_LINES).setSortAsc(false);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -221,6 +237,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void null_measures_are_ordered_after_descending_numeric_measures() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK"))
.setSortOnMetric(METRIC_COVERAGE).setSortAsc(false);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -232,19 +249,21 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
}
@Test
- public void null_measures_are_ordered_after_ascending_numeric_measures() throws SQLException {
- MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK"))
- .setSortOnMetric(METRIC_COVERAGE).setSortAsc(true);
- List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
+ public void null_measures_are_ordered_after_ascending_numeric_measures() throws SQLException {
+ setupData("shared");
+ MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK"))
+ .setSortOnMetric(METRIC_COVERAGE).setSortAsc(true);
+ List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
- // Java project has coverage but not PHP
- assertThat(rows).hasSize(2);
- verifyJavaProject(rows.get(0));
- verifyPhpProject(rows.get(1));
- }
+ // Java project has coverage but not PHP
+ assertThat(rows).hasSize(2);
+ verifyJavaProject(rows.get(0));
+ verifyPhpProject(rows.get(1));
+ }
@Test
public void sort_by_missing_numeric_measure() throws SQLException {
+ setupData("shared");
// coverage measures are not computed
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setSortOnMetric(METRIC_UNKNOWN);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -255,6 +274,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_variation() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortOnMetric(METRIC_LINES).setSortOnPeriod(5);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -265,6 +285,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_descending_variation() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK"))
.setSortOnMetric(METRIC_LINES).setSortOnPeriod(5).setSortAsc(false);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -276,6 +297,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_ascending_date() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortOn(MeasureFilterSort.Field.DATE);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -285,6 +307,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void sort_by_descending_date() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setSortOn(MeasureFilterSort.Field.DATE).setSortAsc(false);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -294,6 +317,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void condition_on_numeric_measure() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA"))
.setSortOnMetric(METRIC_LINES)
.addCondition(new MeasureFilterCondition(METRIC_LINES, MeasureFilterCondition.Operator.GREATER, 200));
@@ -305,6 +329,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void condition_on_measure_variation() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK"))
.setSortOnMetric(METRIC_LINES)
.addCondition(new MeasureFilterCondition(METRIC_LINES, MeasureFilterCondition.Operator.GREATER, 1000).setPeriod(5));
@@ -316,6 +341,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void multiple_conditions_on_numeric_measures() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA"))
.setSortOnMetric(METRIC_LINES)
.addCondition(new MeasureFilterCondition(METRIC_LINES, MeasureFilterCondition.Operator.GREATER, 2))
@@ -328,6 +354,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_language() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setResourceLanguages(Arrays.asList("java", "cobol"));
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -337,6 +364,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_min_date() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setFromDate(DateUtils.parseDate("2012-12-13"));
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -347,6 +375,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_range_of_dates() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK"))
.setFromDate(DateUtils.parseDate("2007-01-01"))
.setToDate(DateUtils.parseDate("2010-01-01"));
@@ -359,6 +388,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_resource_name() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setResourceName("PHP Proj");
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -368,6 +398,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_resource_key_star_regexp() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setResourceKeyRegexp("java*");
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -377,6 +408,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_resource_key_exclamation_mark() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).setResourceKeyRegexp("JaV?_proje*");
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
assertThat(rows).hasSize(1);
@@ -385,6 +417,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_base_resource() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("CLA")).setBaseResourceKey("java_project");
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -396,6 +429,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_parent_resource() throws SQLException {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setBaseResourceKey("java_project").setOnBaseResourceChildren(true);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -405,6 +439,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_parent_without_children() throws Exception {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK", "PAC", "CLA")).setBaseResourceKey("java_project:org.sonar.foo.Big").setOnBaseResourceChildren(true);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext());
@@ -413,6 +448,7 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
@Test
public void filter_by_user_favourites() throws Exception {
+ setupData("shared");
MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK", "FIL")).setUserFavourites(true);
List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext().setUserId(50L));
@@ -421,6 +457,30 @@ public class MeasureFilterExecutorTest extends AbstractDaoTestCase {
verifyPhpProject(rows.get(1));
}
+ @Test
+ public void ignore_person_measures() throws Exception {
+ setupData("ignore_person_measures");
+ MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).addCondition(
+ new MeasureFilterCondition(new Metric("ncloc").setId(1), MeasureFilterCondition.Operator.GREATER, 0.0)
+ );
+ List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext().setUserId(50L));
+
+ assertThat(rows).hasSize(1);
+ assertThat(rows.get(0).getSnapshotId()).isEqualTo(101L);
+ }
+
+ @Test
+ public void ignore_quality_model_measures() throws Exception {
+ setupData("ignore_quality_model_measures");
+ MeasureFilter filter = new MeasureFilter().setResourceQualifiers(Arrays.asList("TRK")).addCondition(
+ new MeasureFilterCondition(new Metric("ncloc").setId(1), MeasureFilterCondition.Operator.GREATER, 0.0)
+ );
+ List<MeasureFilterRow> rows = executor.execute(filter, new MeasureFilterContext().setUserId(50L));
+
+ assertThat(rows).hasSize(1);
+ assertThat(rows.get(0).getSnapshotId()).isEqualTo(101L);
+ }
+
private void verifyJavaProject(MeasureFilterRow row) {
assertThat(row.getSnapshotId()).isEqualTo(JAVA_PROJECT_SNAPSHOT_ID);
assertThat(row.getResourceId()).isEqualTo(JAVA_PROJECT_ID);
diff --git a/sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_person_measures.xml b/sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_person_measures.xml
new file mode 100644
index 00000000000..f2932e5b1bf
--- /dev/null
+++ b/sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_person_measures.xml
@@ -0,0 +1,44 @@
+<dataset>
+ <metrics id="1" name="lines" val_type="FLOAT" description="Lines" domain="Size"
+ short_name="Lines" qualitative="[false]" user_managed="[false]" enabled="[true]" origin="JAV" worst_value="[null]"
+ optimized_best_value="[null]" best_value="[null]" direction="1" hidden="[false]"
+ delete_historical_data="[null]"/>
+
+ <projects kee="java_project" long_name="Java project" scope="PRJ" qualifier="TRK" name="Java project"
+ id="1" root_id="[null]"
+ description="[null]" enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/>
+
+ <snapshots id="101" project_id="1" root_project_id="1" root_snapshot_id="[null]" parent_snapshot_id="[null]"
+ scope="PRJ" qualifier="TRK" path="" depth="0"
+ purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]"
+ period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]"
+ period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]"
+ period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]"
+ created_at="2008-12-20 00:00:00.00" build_date="2008-12-20 00:00:00.00"
+ version="1.0" status="P" islast="[true]"/>
+
+
+ <!-- standard measure -->
+ <project_measures id="1001" metric_id="1" value="500" snapshot_id="101" person_id="[null]"
+ url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
+ variation_value_4="[null]" variation_value_5="400"
+ rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+ RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+ alert_status="[null]" description="[null]" characteristic_id="[null]"/>
+
+ <!-- details of the measure by person -->
+ <project_measures id="1002" metric_id="1" value="300" snapshot_id="101" person_id="30000"
+ url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
+ variation_value_4="[null]" variation_value_5="400"
+ rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+ RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+ alert_status="[null]" description="[null]" characteristic_id="[null]"/>
+
+ <project_measures id="1003" metric_id="1" value="200" snapshot_id="101" person_id="40000"
+ url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
+ variation_value_4="[null]" variation_value_5="400"
+ rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+ RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+ alert_status="[null]" description="[null]" characteristic_id="[null]"/>
+
+</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml b/sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml
new file mode 100644
index 00000000000..1ccceb41d82
--- /dev/null
+++ b/sonar-core/src/test/resources/org/sonar/core/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml
@@ -0,0 +1,44 @@
+<dataset>
+ <metrics id="1" name="lines" val_type="FLOAT" description="Lines" domain="Size"
+ short_name="Lines" qualitative="[false]" user_managed="[false]" enabled="[true]" origin="JAV" worst_value="[null]"
+ optimized_best_value="[null]" best_value="[null]" direction="1" hidden="[false]"
+ delete_historical_data="[null]"/>
+
+ <projects kee="java_project" long_name="Java project" scope="PRJ" qualifier="TRK" name="Java project"
+ id="1" root_id="[null]"
+ description="[null]" enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/>
+
+ <snapshots id="101" project_id="1" root_project_id="1" root_snapshot_id="[null]" parent_snapshot_id="[null]"
+ scope="PRJ" qualifier="TRK" path="" depth="0"
+ purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]"
+ period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]"
+ period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]"
+ period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]"
+ created_at="2008-12-20 00:00:00.00" build_date="2008-12-20 00:00:00.00"
+ version="1.0" status="P" islast="[true]"/>
+
+
+ <!-- standard measure -->
+ <project_measures id="1001" metric_id="1" value="500" snapshot_id="101" characteristic_id="[null]"
+ url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
+ variation_value_4="[null]" variation_value_5="400"
+ rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+ RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+ alert_status="[null]" description="[null]" person_id="[null]"/>
+
+ <!-- details of the measure by model characteristic -->
+ <project_measures id="1002" metric_id="1" value="300" snapshot_id="101" characteristic_id="30000"
+ url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
+ variation_value_4="[null]" variation_value_5="400"
+ rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+ RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+ alert_status="[null]" description="[null]" person_id="[null]"/>
+
+ <project_measures id="1003" metric_id="1" value="200" snapshot_id="101" characteristic_id="40000"
+ url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
+ variation_value_4="[null]" variation_value_5="400"
+ rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
+ RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
+ alert_status="[null]" description="[null]" person_id="[null]"/>
+
+</dataset> \ No newline at end of file