diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-09-02 17:28:28 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-09-02 17:28:45 +0200 |
commit | 565c39fdf39f50fc4faa3c58a671d8fb5d5d64d4 (patch) | |
tree | 777ed8d74bb28e9a751297031274c09e1f79459b /sonar-db | |
parent | 5e26d0b56bb5323b8a816b402b2317646d0a9fe9 (diff) | |
download | sonarqube-565c39fdf39f50fc4faa3c58a671d8fb5d5d64d4.tar.gz sonarqube-565c39fdf39f50fc4faa3c58a671d8fb5d5d64d4.zip |
All measures on person_id_must be ignored
As dev cockpit is not compatible with current dev of SonarQube, all measures related to this plugin must be ignored
For instance, FillMeasuresWithVariationsStep is failing in setVariationMeasures() if there's some dev measures.
Diffstat (limited to 'sonar-db')
-rw-r--r-- | sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml | 1 | ||||
-rw-r--r-- | sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java | 22 |
2 files changed, 3 insertions, 20 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml index f35420afd5f..69ca00c72c2 100644 --- a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml @@ -105,6 +105,7 @@ <foreach item="metricId" index="index" collection="metricIds" open="(" separator=" or " close=")"> pm.metric_id=#{metricId} </foreach> + AND pm.person_id IS NULL </where> </select> diff --git a/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java b/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java index a66cf295007..1b7d7e4121e 100644 --- a/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java @@ -258,34 +258,16 @@ public class MeasureDaoTest { } @Test - public void select_past_measures_on_person_by_component_uuid_and_root_snapshot_id_and_metric_keys() { + public void select_past_measures_ignore_measures_with_person_id() { db.prepareDbUnit(getClass(), "past_measures_with_person_id.xml"); List<PastMeasureDto> measures = underTest.selectByComponentUuidAndProjectSnapshotIdAndMetricIds(db.getSession(), "ABCD", 1000L, ImmutableSet.of(1)); - assertThat(measures).hasSize(3); + assertThat(measures).hasSize(1); Map<Long, PastMeasureDto> pastMeasuresById = pastMeasuresById(measures); PastMeasureDto measure1 = pastMeasuresById.get(1L); - assertThat(measure1.getValue()).isEqualTo(60d); - assertThat(measure1.getMetricId()).isEqualTo(1); - assertThat(measure1.getRuleId()).isNull(); - assertThat(measure1.getCharacteristicId()).isNull(); assertThat(measure1.getPersonId()).isNull(); - - PastMeasureDto measure2 = pastMeasuresById.get(2L); - assertThat(measure2.getValue()).isEqualTo(20d); - assertThat(measure2.getMetricId()).isEqualTo(1); - assertThat(measure2.getRuleId()).isNull(); - assertThat(measure2.getCharacteristicId()).isNull(); - assertThat(measure2.getPersonId()).isEqualTo(20); - - PastMeasureDto measure3 = pastMeasuresById.get(3L); - assertThat(measure3.getValue()).isEqualTo(40d); - assertThat(measure3.getMetricId()).isEqualTo(1); - assertThat(measure3.getRuleId()).isNull(); - assertThat(measure3.getCharacteristicId()).isNull(); - assertThat(measure3.getPersonId()).isEqualTo(21); } @Test |