summaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-01-07 09:35:54 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-01-07 09:35:54 +0100
commit87532c3fc72be01cd76caf0af83420402f7a9cf6 (patch)
tree6196cf4c4cd7e1fb03a35c89a51a800f7c3bfb13 /sonar-core/src
parent93ff1bed16c7ca80a5f371a6ba9110a3d2363723 (diff)
downloadsonarqube-87532c3fc72be01cd76caf0af83420402f7a9cf6.tar.gz
sonarqube-87532c3fc72be01cd76caf0af83420402f7a9cf6.zip
Search all profiles should be sorted by profile name
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java12
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/qualityprofile/db/QualityProfileDaoTest/select_all_is_sorted_by_profile_name.xml12
3 files changed, 25 insertions, 0 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
index a08c9aa888b..3c80702667c 100644
--- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
@@ -15,6 +15,7 @@
<select id="selectAll" parameterType="map" resultType="QualityProfile">
SELECT <include refid="profilesColumns"/>
FROM rules_profiles p
+ ORDER BY p.name
</select>
<select id="selectByNameAndLanguage" parameterType="map" resultType="QualityProfile">
diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
index 28e09e5d59b..ba0d7e3d7e1 100644
--- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
@@ -63,6 +63,18 @@ public class QualityProfileDaoTest extends AbstractDaoTestCase {
}
@Test
+ public void select_all_is_sorted_by_profile_name() {
+ setupData("select_all_is_sorted_by_profile_name");
+
+ List<QualityProfileDto> dtos = dao.selectAll();
+
+ assertThat(dtos).hasSize(3);
+ assertThat(dtos.get(0).getName()).isEqualTo("First");
+ assertThat(dtos.get(1).getName()).isEqualTo("Second");
+ assertThat(dtos.get(2).getName()).isEqualTo("Third");
+ }
+
+ @Test
public void select_default_profile() {
setupData("shared");
diff --git a/sonar-core/src/test/resources/org/sonar/core/qualityprofile/db/QualityProfileDaoTest/select_all_is_sorted_by_profile_name.xml b/sonar-core/src/test/resources/org/sonar/core/qualityprofile/db/QualityProfileDaoTest/select_all_is_sorted_by_profile_name.xml
new file mode 100644
index 00000000000..563009506cf
--- /dev/null
+++ b/sonar-core/src/test/resources/org/sonar/core/qualityprofile/db/QualityProfileDaoTest/select_all_is_sorted_by_profile_name.xml
@@ -0,0 +1,12 @@
+<dataset>
+
+ <rules_profiles id="3" name="Third" language="java" parent_name="[null]" version="1"
+ used_profile="[false]"/>
+
+ <rules_profiles id="1" name="First" language="java" parent_name="[null]" version="1"
+ used_profile="[false]"/>
+
+ <rules_profiles id="2" name="Second" language="java" parent_name="[null]" version="1"
+ used_profile="[false]"/>
+
+</dataset>