aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-02-16 16:36:00 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-02-16 16:49:14 +0100
commitd9212df91042bdb88d45160c6bb3e5a80fa59a1b (patch)
treeb367fefde8657bde184e4b00604047d1905b7666 /sonar-db
parent5ea1d4b93b202f07ad915375ab9eca9a146d9fda (diff)
downloadsonarqube-d9212df91042bdb88d45160c6bb3e5a80fa59a1b.tar.gz
sonarqube-d9212df91042bdb88d45160c6bb3e5a80fa59a1b.zip
SONAR-7352 Deterministic order of groups in My Account page
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml1
-rw-r--r--sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java4
2 files changed, 3 insertions, 2 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml b/sonar-db/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml
index 36591ceea05..5e9302d33d9 100644
--- a/sonar-db/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml
@@ -56,6 +56,7 @@
#{login}
</foreach>
</where>
+ ORDER BY u.login, g.name, g.id
</select>
<sql id="userCommonClauses">
diff --git a/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java b/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java
index 8545c960628..6b82b32bf70 100644
--- a/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java
@@ -175,8 +175,8 @@ public class GroupMembershipDaoTest {
assertThat(dao.selectGroupsByLogins(dbTester.getSession(), Arrays.<String>asList()).keys()).isEmpty();
Multimap<String, String> groupsByLogin = dao.selectGroupsByLogins(dbTester.getSession(), Arrays.asList("two-hundred", "two-hundred-one", "two-hundred-two"));
- assertThat(groupsByLogin.get("two-hundred")).containsOnly("sonar-administrators", "sonar-users", "sonar-reviewers");
- assertThat(groupsByLogin.get("two-hundred-one")).containsOnly("sonar-users");
+ assertThat(groupsByLogin.get("two-hundred")).containsExactly("sonar-administrators", "sonar-reviewers", "sonar-users");
+ assertThat(groupsByLogin.get("two-hundred-one")).containsExactly("sonar-users");
assertThat(groupsByLogin.get("two-hundred-two")).isEmpty();
}