diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-06-19 15:55:53 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-06-19 15:56:10 +0200 |
commit | d7e2e31271ec68436da21e077261d1e367f56809 (patch) | |
tree | a6fda3d96dde27537fb284bb570d16fe14cf1fd9 /sonar-core | |
parent | dd03761c7936d7f1111ded5c4fc630620ec6cc88 (diff) | |
download | sonarqube-d7e2e31271ec68436da21e077261d1e367f56809.tar.gz sonarqube-d7e2e31271ec68436da21e077261d1e367f56809.zip |
Fix MeasureDao on PostgreSQL and Oracle
Diffstat (limited to 'sonar-core')
3 files changed, 13 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/PastMeasureDto.java b/sonar-core/src/main/java/org/sonar/core/measure/db/PastMeasureDto.java index cb8618aecdc..ac06c4946e0 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/db/PastMeasureDto.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/db/PastMeasureDto.java @@ -26,12 +26,22 @@ import javax.annotation.Nullable; public class PastMeasureDto { + private Long id; private Double value; private Integer metricId; private Integer ruleId; private Integer characteristicId; private Integer personId; + public Long getId() { + return id; + } + + public PastMeasureDto setId(Long id) { + this.id = id; + return this; + } + public double getValue() { Objects.requireNonNull(value); return value; diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml index e92e260144c..8c13c1d2472 100644 --- a/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml @@ -71,7 +71,7 @@ </select> <select id="selectByComponentUuidAndProjectSnapshotIdAndStatusAndMetricIds" parameterType="map" resultType="org.sonar.core.measure.db.PastMeasureDto"> - SELECT pm.metric_id as metricId, pm.rule_id as ruleId, pm.characteristic_id as characteristicId, pm.person_id as personId, pm.value as value + SELECT pm.id as id, pm.metric_id as metricId, pm.rule_id as ruleId, pm.characteristic_id as characteristicId, pm.person_id as personId, pm.value as value FROM project_measures pm INNER JOIN snapshots s ON s.id=pm.snapshot_id AND s.status=#{status} INNER JOIN projects p ON p.id=s.project_id AND p.enabled=${_true} diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/PastMeasureDtoTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/PastMeasureDtoTest.java index 85a3ada44a6..2baf547ff16 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/db/PastMeasureDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/db/PastMeasureDtoTest.java @@ -29,12 +29,14 @@ public class PastMeasureDtoTest { @Test public void test_getter_and_setter() throws Exception { PastMeasureDto dto = new PastMeasureDto() + .setId(10L) .setValue(1d) .setMetricId(2) .setRuleId(3) .setCharacteristicId(4) .setPersonId(5); + assertThat(dto.getId()).isEqualTo(10L); assertThat(dto.hasValue()).isTrue(); assertThat(dto.getValue()).isEqualTo(1d); assertThat(dto.getMetricId()).isEqualTo(2); |