aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/permission/PermissionDaoTest.java6
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/permission/PermissionDaoTest/selectAllPermissionTemplates.xml6
3 files changed, 10 insertions, 6 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml b/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
index 0ca7a418f63..5999d29729d 100644
--- a/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
@@ -68,13 +68,13 @@
</select>
<select id="selectByName" parameterType="String" resultType="PermissionTemplate">
- SELECT id, name, description, created_at AS createdAt, updated_at AS updatedAt
+ SELECT id, name, kee, description, created_at AS createdAt, updated_at AS updatedAt
FROM permission_templates
WHERE name = #{templateName}
</select>
<select id="selectAllPermissionTemplates" resultType="PermissionTemplate">
- SELECT id, name, description, created_at AS createdAt, updated_at AS updatedAt
+ SELECT id, name, kee, description, created_at AS createdAt, updated_at AS updatedAt
FROM permission_templates
</select>
diff --git a/sonar-core/src/test/java/org/sonar/core/permission/PermissionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/PermissionDaoTest.java
index 57d312aceb9..424943b66ad 100644
--- a/sonar-core/src/test/java/org/sonar/core/permission/PermissionDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/permission/PermissionDaoTest.java
@@ -93,6 +93,7 @@ public class PermissionDaoTest extends AbstractDaoTestCase {
assertThat(permissionTemplate).isNotNull();
assertThat(permissionTemplate.getName()).isEqualTo("my template");
+ assertThat(permissionTemplate.getKee()).isEqualTo("my_template_20130102_030405");
assertThat(permissionTemplate.getDescription()).isEqualTo("my description");
assertThat(permissionTemplate.getUsersPermissions()).hasSize(3);
assertThat(permissionTemplate.getUsersPermissions()).onProperty("userId").containsOnly(1L, 2L, 1L);
@@ -126,11 +127,12 @@ public class PermissionDaoTest extends AbstractDaoTestCase {
assertThat(permissionTemplate).isNotNull();
assertThat(permissionTemplate.getId()).isEqualTo(1L);
assertThat(permissionTemplate.getName()).isEqualTo("my template");
+ assertThat(permissionTemplate.getKee()).isEqualTo("my_template_20130102_030405");
assertThat(permissionTemplate.getDescription()).isEqualTo("my description");
}
@Test
- public void should_select_permission_template_by_id() throws Exception {
+ public void should_select_permission_template_by_key() throws Exception {
setupData("selectPermissionTemplate");
PermissionTemplateDto permissionTemplate = permissionDao.selectTemplateByKey("my_template_20130102_030405");
@@ -138,6 +140,7 @@ public class PermissionDaoTest extends AbstractDaoTestCase {
assertThat(permissionTemplate).isNotNull();
assertThat(permissionTemplate.getId()).isEqualTo(1L);
assertThat(permissionTemplate.getName()).isEqualTo("my template");
+ assertThat(permissionTemplate.getKee()).isEqualTo("my_template_20130102_030405");
assertThat(permissionTemplate.getDescription()).isEqualTo("my description");
}
@@ -150,6 +153,7 @@ public class PermissionDaoTest extends AbstractDaoTestCase {
assertThat(permissionTemplates).hasSize(3);
assertThat(permissionTemplates).onProperty("id").containsOnly(1L, 2L, 3L);
assertThat(permissionTemplates).onProperty("name").containsOnly("template1", "template2", "template3");
+ assertThat(permissionTemplates).onProperty("kee").containsOnly("template1_20130102_030405", "template2_20130102_030405", "template3_20130102_030405");
assertThat(permissionTemplates).onProperty("description").containsOnly("description1", "description2", "description3");
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/permission/PermissionDaoTest/selectAllPermissionTemplates.xml b/sonar-core/src/test/resources/org/sonar/core/permission/PermissionDaoTest/selectAllPermissionTemplates.xml
index 1fa43bea18c..65a68bb4b4b 100644
--- a/sonar-core/src/test/resources/org/sonar/core/permission/PermissionDaoTest/selectAllPermissionTemplates.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/permission/PermissionDaoTest/selectAllPermissionTemplates.xml
@@ -1,5 +1,5 @@
<dataset>
- <permission_templates id="1" name="template1" kee="my_template_20130102_030405" description="description1" created_at="[null]" updated_at="[null]"/>
- <permission_templates id="2" name="template2" kee="my_template_20130102_030405" description="description2" created_at="[null]" updated_at="[null]"/>
- <permission_templates id="3" name="template3" kee="my_template_20130102_030405" description="description3" created_at="[null]" updated_at="[null]"/>
+ <permission_templates id="1" name="template1" kee="template1_20130102_030405" description="description1" created_at="[null]" updated_at="[null]"/>
+ <permission_templates id="2" name="template2" kee="template2_20130102_030405" description="description2" created_at="[null]" updated_at="[null]"/>
+ <permission_templates id="3" name="template3" kee="template3_20130102_030405" description="description3" created_at="[null]" updated_at="[null]"/>
</dataset> \ No newline at end of file