diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-16 12:10:13 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-16 12:10:27 +0200 |
commit | 9fea95aa451ac0bdca470ff30c8826815feee8fd (patch) | |
tree | 11d7e00123cedbe26944d52c626c80dd32c18d9f /sonar-core/src | |
parent | 3425d861e177847b96ce989fd519b07b192b4fd3 (diff) | |
download | sonarqube-9fea95aa451ac0bdca470ff30c8826815feee8fd.tar.gz sonarqube-9fea95aa451ac0bdca470ff30c8826815feee8fd.zip |
SONAR-5338 Read test info from the test_data measure
Diffstat (limited to 'sonar-core/src')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/measure/db/MeasureMapper.java | 5 | ||||
-rw-r--r-- | sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureMapper.java b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureMapper.java index 6752fe6f6b3..572d70715cd 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureMapper.java @@ -22,6 +22,8 @@ package org.sonar.core.measure.db; import org.apache.ibatis.annotations.Param; +import javax.annotation.CheckForNull; + import java.util.List; public interface MeasureMapper { @@ -30,6 +32,9 @@ public interface MeasureMapper { List<MeasureDto> selectByComponentAndMetrics(@Param("componentKey") String componentKey, @Param("metricKeys") List<String> metricKeys); + @CheckForNull + MeasureDto selectByComponentAndMetric(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey); + long countByKey(@Param("key") MeasureKey key); } 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 cde157e101f..0964ff196f1 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 @@ -50,6 +50,22 @@ </where> </select> + <select id="selectByComponentAndMetric" parameterType="map" resultType="Measure"> + SELECT metric.name as metric_name, + <include refid="measureColumns"/> + FROM project_measures pm + INNER JOIN snapshots s ON s.id=pm.snapshot_id AND s.islast=${_true} + INNER JOIN projects p ON p.id=s.project_id AND p.enabled=${_true} + INNER JOIN metrics metric ON metric.id=pm.metric_id + <where> + AND p.kee = #{componentKey} + AND metric.name=#{metricKey} + AND pm.rule_id IS NULL + AND pm.characteristic_id IS NULL + AND pm.person_id IS NULL + </where> + </select> + <select id="countByKey" parameterType="map" resultType="long"> SELECT count(pm.id) FROM project_measures pm |