aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/test
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-07-15 18:46:24 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-07-15 18:46:24 +0200
commitfc80b8c4bbfc89314c99e2817d1fed5b8123a3e2 (patch)
tree0e5b62411f99a3976a3d2ab0d0924c1b48c78a4e /sonar-core/src/test
parent5b745f6619eb0dea2380e4428e135dbb1c2124d5 (diff)
downloadsonarqube-fc80b8c4bbfc89314c99e2817d1fed5b8123a3e2.tar.gz
sonarqube-fc80b8c4bbfc89314c99e2817d1fed5b8123a3e2.zip
SONAR-4466 Provision the logical key in the model objects used by the views
Diffstat (limited to 'sonar-core/src/test')
-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
2 files changed, 8 insertions, 4 deletions
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