aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-09-28 12:12:41 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-09-28 16:32:40 +0200
commita30dc8ee3dd9e0eeb1f76829aa7a80f4e9e5387c (patch)
tree0ed6eda531182237412e16ec3ae052a253398a41 /sonar-db
parent9c1f545bacb5fe3802af08cce58c099a6e2f9f76 (diff)
downloadsonarqube-a30dc8ee3dd9e0eeb1f76829aa7a80f4e9e5387c.tar.gz
sonarqube-a30dc8ee3dd9e0eeb1f76829aa7a80f4e9e5387c.zip
Rename PermissionDao to GroupPermissionDao
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/DaoModule.java4
-rw-r--r--sonar-db/src/main/java/org/sonar/db/DbClient.java10
-rw-r--r--sonar-db/src/main/java/org/sonar/db/MyBatis.java2
-rw-r--r--sonar-db/src/main/java/org/sonar/db/permission/GroupPermissionDao.java (renamed from sonar-db/src/main/java/org/sonar/db/permission/PermissionDao.java)6
-rw-r--r--sonar-db/src/main/java/org/sonar/db/permission/GroupPermissionMapper.java (renamed from sonar-db/src/main/java/org/sonar/db/permission/PermissionMapper.java)2
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml (renamed from sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml)2
-rw-r--r--sonar-db/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java (renamed from sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionDaoTest.java)4
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/select_only_enable_users.xml18
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions.xml17
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions_should_be_sorted_by_user_name.xml11
10 files changed, 15 insertions, 61 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/DaoModule.java b/sonar-db/src/main/java/org/sonar/db/DaoModule.java
index 1858ba6a839..211cda05e61 100644
--- a/sonar-db/src/main/java/org/sonar/db/DaoModule.java
+++ b/sonar-db/src/main/java/org/sonar/db/DaoModule.java
@@ -50,7 +50,7 @@ import org.sonar.db.measure.custom.CustomMeasureDao;
import org.sonar.db.metric.MetricDao;
import org.sonar.db.notification.NotificationQueueDao;
import org.sonar.db.organization.OrganizationDao;
-import org.sonar.db.permission.PermissionDao;
+import org.sonar.db.permission.GroupPermissionDao;
import org.sonar.db.permission.UserPermissionDao;
import org.sonar.db.permission.template.PermissionTemplateCharacteristicDao;
import org.sonar.db.permission.template.PermissionTemplateDao;
@@ -104,7 +104,7 @@ public class DaoModule extends Module {
MetricDao.class,
NotificationQueueDao.class,
OrganizationDao.class,
- PermissionDao.class,
+ GroupPermissionDao.class,
PermissionTemplateDao.class,
PermissionTemplateCharacteristicDao.class,
PropertiesDao.class,
diff --git a/sonar-db/src/main/java/org/sonar/db/DbClient.java b/sonar-db/src/main/java/org/sonar/db/DbClient.java
index 4596690ddc7..fedd9d58fe4 100644
--- a/sonar-db/src/main/java/org/sonar/db/DbClient.java
+++ b/sonar-db/src/main/java/org/sonar/db/DbClient.java
@@ -50,7 +50,7 @@ import org.sonar.db.measure.custom.CustomMeasureDao;
import org.sonar.db.metric.MetricDao;
import org.sonar.db.notification.NotificationQueueDao;
import org.sonar.db.organization.OrganizationDao;
-import org.sonar.db.permission.PermissionDao;
+import org.sonar.db.permission.GroupPermissionDao;
import org.sonar.db.permission.UserPermissionDao;
import org.sonar.db.permission.template.PermissionTemplateCharacteristicDao;
import org.sonar.db.permission.template.PermissionTemplateDao;
@@ -97,7 +97,7 @@ public class DbClient {
private final UserTokenDao userTokenDao;
private final GroupMembershipDao groupMembershipDao;
private final RoleDao roleDao;
- private final PermissionDao permissionDao;
+ private final GroupPermissionDao groupPermissionDao;
private final PermissionTemplateDao permissionTemplateDao;
private final PermissionTemplateCharacteristicDao permissionTemplateCharacteristicDao;
private final IssueDao issueDao;
@@ -158,7 +158,7 @@ public class DbClient {
userTokenDao = getDao(map, UserTokenDao.class);
groupMembershipDao = getDao(map, GroupMembershipDao.class);
roleDao = getDao(map, RoleDao.class);
- permissionDao = getDao(map, PermissionDao.class);
+ groupPermissionDao = getDao(map, GroupPermissionDao.class);
permissionTemplateDao = getDao(map, PermissionTemplateDao.class);
permissionTemplateCharacteristicDao = getDao(map, PermissionTemplateCharacteristicDao.class);
issueDao = getDao(map, IssueDao.class);
@@ -294,8 +294,8 @@ public class DbClient {
return roleDao;
}
- public PermissionDao permissionDao() {
- return permissionDao;
+ public GroupPermissionDao groupPermissionDao() {
+ return groupPermissionDao;
}
public PermissionTemplateDao permissionTemplateDao() {
diff --git a/sonar-db/src/main/java/org/sonar/db/MyBatis.java b/sonar-db/src/main/java/org/sonar/db/MyBatis.java
index 5ce61fb3e1f..3e9fdecd2dc 100644
--- a/sonar-db/src/main/java/org/sonar/db/MyBatis.java
+++ b/sonar-db/src/main/java/org/sonar/db/MyBatis.java
@@ -223,7 +223,7 @@ public class MyBatis {
// ResourceMapper has to be loaded before IssueMapper because this last one used it
confBuilder.loadMapper(ResourceMapper.class);
- confBuilder.loadMapper("org.sonar.db.permission.PermissionMapper");
+ confBuilder.loadMapper("org.sonar.db.permission.GroupPermissionMapper");
// keep them sorted alphabetically
Class<?>[] mappers = {
ActiveDashboardMapper.class,
diff --git a/sonar-db/src/main/java/org/sonar/db/permission/PermissionDao.java b/sonar-db/src/main/java/org/sonar/db/permission/GroupPermissionDao.java
index 0dd1ab25811..37addafcb70 100644
--- a/sonar-db/src/main/java/org/sonar/db/permission/PermissionDao.java
+++ b/sonar-db/src/main/java/org/sonar/db/permission/GroupPermissionDao.java
@@ -33,7 +33,7 @@ import org.sonar.db.user.GroupRoleDto;
import static org.sonar.db.DatabaseUtils.executeLargeInputs;
import static org.sonar.db.DatabaseUtils.executeLargeInputsWithoutOutput;
-public class PermissionDao implements Dao {
+public class GroupPermissionDao implements Dao {
private static final String COMPONENT_ID_PARAMETER = "componentId";
private static final String ANYONE_GROUP_PARAMETER = "anyoneGroup";
@@ -78,8 +78,8 @@ public class PermissionDao implements Dao {
});
}
- private static PermissionMapper mapper(DbSession session) {
- return session.getMapper(PermissionMapper.class);
+ private static GroupPermissionMapper mapper(DbSession session) {
+ return session.getMapper(GroupPermissionMapper.class);
}
}
diff --git a/sonar-db/src/main/java/org/sonar/db/permission/PermissionMapper.java b/sonar-db/src/main/java/org/sonar/db/permission/GroupPermissionMapper.java
index aae4ccc0e5f..f89fc8d7d08 100644
--- a/sonar-db/src/main/java/org/sonar/db/permission/PermissionMapper.java
+++ b/sonar-db/src/main/java/org/sonar/db/permission/GroupPermissionMapper.java
@@ -27,7 +27,7 @@ import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.sonar.db.user.GroupRoleDto;
-public interface PermissionMapper {
+public interface GroupPermissionMapper {
int countGroups(Map<String, Object> parameters);
diff --git a/sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml b/sonar-db/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml
index dd15e1e8fde..867361b54d9 100644
--- a/sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.sonar.db.permission.PermissionMapper">
+<mapper namespace="org.sonar.db.permission.GroupPermissionMapper">
<sql id="usersSelection">
FROM users u
diff --git a/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionDaoTest.java b/sonar-db/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java
index d9cf4decb30..20599cda2aa 100644
--- a/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java
@@ -48,7 +48,7 @@ import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN;
import static org.sonar.db.component.ComponentTesting.newProjectDto;
import static org.sonar.db.user.GroupTesting.newGroupDto;
-public class GroupWithPermissionDaoTest {
+public class GroupPermissionDaoTest {
private static final long COMPONENT_ID = 100L;
@@ -59,7 +59,7 @@ public class GroupWithPermissionDaoTest {
private ComponentDbTester componentDb = new ComponentDbTester(db);
private DbSession dbSession = db.getSession();
- private PermissionDao underTest = new PermissionDao();
+ private GroupPermissionDao underTest = new GroupPermissionDao();
@Test
public void group_count_by_permission_and_component_id() {
diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/select_only_enable_users.xml b/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/select_only_enable_users.xml
deleted file mode 100644
index 662af1a0a8c..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/select_only_enable_users.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<dataset>
-
- <users id="200" login="user1" name="User1" active="[true]"/>
- <users id="201" login="user2" name="User2" active="[true]"/>
- <users id="202" login="user3" name="User3" active="[true]"/>
- <users id="999" login="disabledUser" name="disabledUser" active="[false]"/>
-
- <!-- Project permissions -->
- <user_roles id="1" user_id="200" resource_id="100" role="user"/>
- <user_roles id="2" user_id="200" resource_id="100" role="admin"/>
- <user_roles id="3" user_id="200" resource_id="100" role="codeviewer"/>
-
- <user_roles id="4" user_id="201" resource_id="100" role="user"/>
-
- <!-- Global permission -->
- <user_roles id="10" user_id="200" resource_id="[null]" role="admin"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions.xml b/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions.xml
deleted file mode 100644
index 6f40d31f21d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<dataset>
-
- <users id="200" login="user1" name="User1" active="[true]"/>
- <users id="201" login="user2" name="User2" active="[true]"/>
- <users id="202" login="user3" name="User3" active="[true]"/>
-
- <!-- Project permissions -->
- <user_roles id="1" user_id="200" resource_id="100" role="user"/>
- <user_roles id="2" user_id="200" resource_id="100" role="admin"/>
- <user_roles id="3" user_id="200" resource_id="100" role="codeviewer"/>
-
- <user_roles id="4" user_id="201" resource_id="100" role="user"/>
-
- <!-- Global permission -->
- <user_roles id="10" user_id="200" resource_id="[null]" role="admin"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions_should_be_sorted_by_user_name.xml b/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions_should_be_sorted_by_user_name.xml
deleted file mode 100644
index 6b39124ce6c..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/permission/UserWithPermissionDaoTest/users_with_permissions_should_be_sorted_by_user_name.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
- <users id="200" login="user3" name="User3" active="[true]"/>
- <users id="201" login="user1" name="User1" active="[true]"/>
- <users id="202" login="user2" name="User2" active="[true]"/>
-
- <user_roles id="1" user_id="200" resource_id="100" role="user"/>
- <user_roles id="2" user_id="200" resource_id="100" role="admin"/>
- <user_roles id="3" user_id="200" resource_id="100" role="codeviewer"/>
-
-</dataset>