]> source.dussan.org Git - sonarqube.git/commitdiff
All measures on person_id_must be ignored
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 2 Sep 2015 15:28:28 +0000 (17:28 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 2 Sep 2015 15:28:45 +0000 (17:28 +0200)
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.

sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml
sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java

index f35420afd5fb7bf99f0531a302e016c8eed25e1d..69ca00c72c2e780e6925a307e863db391456ed95 100644 (file)
       <foreach item="metricId" index="index" collection="metricIds" open="(" separator=" or " close=")">
         pm.metric_id=#{metricId}
       </foreach>
+      AND pm.person_id IS NULL
     </where>
   </select>
 
index a66cf295007bb6782d67168a37c64539c589b0a4..1b7d7e4121e7c9cafcc3b836655a5a6d648eb5b9 100644 (file)
@@ -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