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 13:03:06 +0200 |
commit | d8f606d1de1b13672f3aee769a7c25f37dc8aa48 (patch) | |
tree | fbd85f255359171ac1099ccf94f30669543f82a6 /sonar-core | |
parent | 16fe780b56393a0fe0d483be895af8433ab85ea9 (diff) | |
download | sonarqube-d8f606d1de1b13672f3aee769a7c25f37dc8aa48.tar.gz sonarqube-d8f606d1de1b13672f3aee769a7c25f37dc8aa48.zip |
SONAR-5338 Read test info from the test_data measure
Diffstat (limited to 'sonar-core')
-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 |