]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9140 drop some DbUnit in AuthorizationDaoTest
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 19 Apr 2017 15:02:52 +0000 (17:02 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 27 Apr 2017 12:25:54 +0000 (14:25 +0200)
those for UTs on methodis keepAuthorizedProjectIds and keepAuthorizedUsersForRoleAndProject

server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/anonymous_should_be_authorized.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/group_should_be_authorized.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/user_should_be_authorized.xml [deleted file]

index 27d1436e522f8a20a85e662464a137d4808fe317..8438486c9212d6b22215c4a3cad2d9931118cf56 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.db.permission;
 
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
 import org.junit.Before;
@@ -111,24 +110,25 @@ public class AuthorizationDaoTest {
 
   @Test
   public void user_should_be_authorized() {
-    // but user is not in an authorized group
-    db.prepareDbUnit(getClass(), "user_should_be_authorized.xml");
-
-    Collection<Long> componentIds = underTest.keepAuthorizedProjectIds(dbSession,
-      newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT),
-      USER, "user");
-
-    assertThat(componentIds).containsOnly(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT);
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    ComponentDto project3 = db.components().insertPublicProject(organization);
+    UserDto user = db.users().insertUser("u1");
+    GroupDto group = db.users().insertGroup(organization);
+    db.users().insertProjectPermissionOnUser(user, UserRole.USER, project2);
+    db.users().insertProjectPermissionOnUser(user, UserRole.USER, project3);
+    db.users().insertMember(group, user);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.USER, project1);
+
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project2.getId(), project3.getId()), user.getId(), UserRole.USER))
+      .containsOnly(project2.getId(), project3.getId());
 
     // user does not have the role "admin"
-    componentIds = underTest.keepAuthorizedProjectIds(dbSession,
-      newHashSet(PROJECT_ID),
-      USER, "admin");
-    assertThat(componentIds).isEmpty();
-
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession,
-      Collections.emptySet(),
-      USER, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project2.getId()), user.getId(), UserRole.ADMIN))
+      .isEmpty();
+
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), user.getId(), UserRole.ADMIN))
+      .isEmpty();
   }
 
   @Test
@@ -226,118 +226,197 @@ public class AuthorizationDaoTest {
 
   @Test
   public void keep_authorized_project_ids_for_user() {
-    db.prepareDbUnit(getClass(), "keep_authorized_project_ids_for_user.xml");
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user1, UserRole.CODEVIEWER, project2);
 
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT), USER, "user")).containsOnly(PROJECT_ID);
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId(), project2.getId()), user1.getId(), UserRole.USER))
+      .containsOnly(project1.getId());
 
     // user does not have the role "admin"
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(PROJECT_ID), USER, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId()), user1.getId(), UserRole.ADMIN)).isEmpty();
 
     // Empty list
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), USER, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), user1.getId(), UserRole.ADMIN)).isEmpty();
   }
 
   @Test
   public void keep_authorized_project_ids_for_group() {
-    db.prepareDbUnit(getClass(), "keep_authorized_project_ids_for_group.xml");
-
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT), USER, "user")).containsOnly(PROJECT_ID);
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    GroupDto group = db.users().insertGroup(organization);
+    db.users().insertMembers(group, user1);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.CODEVIEWER, project2);
+
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId(), project2.getId()), user1.getId(), UserRole.USER))
+      .containsOnly(project1.getId());
 
     // user does not have the role "admin"
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(PROJECT_ID), USER, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId()), user1.getId(), UserRole.ADMIN))
+      .isEmpty();
 
     // Empty list
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), USER, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), user1.getId(), UserRole.ADMIN))
+      .isEmpty();
   }
 
   @Test
   public void keep_authorized_project_ids_for_anonymous() {
-    db.prepareDbUnit(getClass(), "keep_authorized_project_ids_for_anonymous.xml");
-
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT), null, "user")).containsOnly(PROJECT_ID);
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    GroupDto group = db.users().insertGroup(organization);
+    db.users().insertMembers(group, user1);
+    db.users().insertProjectPermissionOnAnyone(UserRole.USER, project1);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.CODEVIEWER, project2);
+
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId(), project2.getId()), null, UserRole.USER))
+      .containsOnly(project1.getId());
 
     // user does not have the role "admin"
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(PROJECT_ID), null, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId()), null, UserRole.ADMIN))
+      .isEmpty();
 
     // Empty list
-    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), null, "admin")).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, Collections.emptySet(), null, UserRole.ADMIN))
+      .isEmpty();
   }
 
   @Test
   public void group_should_be_authorized() {
-    // user is in an authorized group
-    db.prepareDbUnit(getClass(), "group_should_be_authorized.xml");
-
-    Collection<Long> componentIds = underTest.keepAuthorizedProjectIds(dbSession,
-      newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT),
-      USER, "user");
-
-    assertThat(componentIds).containsOnly(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT);
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    ComponentDto project3 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    GroupDto group = db.users().insertGroup(organization);
+    db.users().insertMembers(group, user1);
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.USER, project2);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.USER, project3);
+
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project2.getId(), project3.getId()), user1.getId(), UserRole.USER))
+      .containsOnly(project2.getId(), project3.getId());
 
     // group does not have the role "admin"
-    componentIds = underTest.keepAuthorizedProjectIds(dbSession,
-      newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT),
-      USER, "admin");
-    assertThat(componentIds).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project2.getId(), project3.getId()), user1.getId(), UserRole.ADMIN))
+      .isEmpty();
   }
 
   @Test
   public void anonymous_should_be_authorized() {
-    db.prepareDbUnit(getClass(), "anonymous_should_be_authorized.xml");
-
-    Collection<Long> componentIds = underTest.keepAuthorizedProjectIds(dbSession,
-      newHashSet(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT),
-      null, "user");
-
-    assertThat(componentIds).containsOnly(PROJECT_ID, PROJECT_ID_WITHOUT_SNAPSHOT);
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    GroupDto group = db.users().insertGroup(organization);
+    db.users().insertMembers(group, user1);
+    db.users().insertProjectPermissionOnAnyone(UserRole.USER, project1);
+    db.users().insertProjectPermissionOnAnyone(UserRole.USER, project2);
+
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId(), project2.getId()), null, UserRole.USER))
+      .containsOnly(project1.getId(), project2.getId());
 
     // group does not have the role "admin"
-    componentIds = underTest.keepAuthorizedProjectIds(dbSession,
-      newHashSet(PROJECT_ID),
-      null, "admin");
-    assertThat(componentIds).isEmpty();
+    assertThat(underTest.keepAuthorizedProjectIds(dbSession, newHashSet(project1.getId()), null, "admin"))
+      .isEmpty();
   }
 
   @Test
   public void keep_authorized_users_for_role_and_project_for_user() {
-    db.prepareDbUnit(getClass(), "keep_authorized_users_for_role_and_project_for_user.xml");
+    OrganizationDto organization = db.organizations().insert();
+    UserDto user1 = db.users().insertUser("u1");
+    UserDto user2 = db.users().insertUser("u2");
+    UserDto user3 = db.users().insertUser("u3");
+    GroupDto group = db.users().insertGroup(organization);
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    db.users().insertMembers(group, user1);
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user2, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user3, UserRole.ADMIN, project1);
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project2);
+    db.users().insertProjectPermissionOnGroup(group, UserRole.USER, project2);
 
     assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession,
-      // Only 100 and 101 has 'user' role on project
-      newHashSet(100, 101, 102), "user", PROJECT_ID)).containsOnly(100, 101);
+      newHashSet(user1.getId(), user2.getId(), user3.getId()), UserRole.USER, project1.getId()))
+        .containsOnly(user1.getId(), user2.getId());
 
     assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession,
       // Only 100 and 101 has 'user' role on project
-      newHashSet(100), "user", PROJECT_ID)).containsOnly(100);
+      newHashSet(user1.getId()), UserRole.USER, project1.getId())).containsOnly(user1.getId());
 
     // user does not have the role "admin"
-    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, newHashSet(100), "admin", PROJECT_ID)).isEmpty();
+    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, newHashSet(user1.getId()), UserRole.ADMIN, project1.getId()))
+      .isEmpty();
 
     // Empty list
-    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, Collections.emptySet(), "user", PROJECT_ID)).isEmpty();
+    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, Collections.emptySet(), UserRole.USER, project1.getId()))
+      .isEmpty();
   }
 
   @Test
   public void keep_authorized_users_for_role_and_project_for_group() {
-    db.prepareDbUnit(getClass(), "keep_authorized_users_for_role_and_project_for_group.xml");
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    ComponentDto project3 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    UserDto user2 = db.users().insertUser("u2");
+    UserDto user3 = db.users().insertUser("u3");
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user2, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user3, UserRole.USER, project1);
+    GroupDto group1 = db.users().insertGroup(organization);
+    GroupDto group2 = db.users().insertGroup(organization);
+    db.users().insertMembers(group1, user1, user2);
+    db.users().insertMembers(group2, user3);
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user2, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user3, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnGroup(group1, UserRole.USER, project2);
+    db.users().insertProjectPermissionOnGroup(group2, UserRole.USER, project3);
 
     assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession,
-      // Only 100 and 101 has 'user' role on project
-      newHashSet(100, 101, 102), "user", PROJECT_ID)).containsOnly(100, 101);
+      newHashSet(user1.getId(), user2.getId(), user3.getId()), UserRole.USER, project2.getId()))
+        .containsOnly(user1.getId(), user2.getId());
 
     assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession,
-      newHashSet(100), "user", PROJECT_ID)).containsOnly(100);
+      newHashSet(user1.getId()), UserRole.USER, project2.getId())).containsOnly(user1.getId());
 
-    // user does not have the role "admin"
-    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, newHashSet(100), "admin", PROJECT_ID)).isEmpty();
+    // no user has the role "admin"
+    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, newHashSet(user1.getId()), UserRole.ADMIN, project2.getId()))
+      .isEmpty();
 
-    // Empty list
-    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, Collections.emptySet(), "user", PROJECT_ID)).isEmpty();
+    // Empty user id set
+    assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, Collections.emptySet(), UserRole.USER, project2.getId())).isEmpty();
   }
 
   @Test
   public void keep_authorized_users_returns_empty_list_for_role_and_project_for_anonymous() {
-    db.prepareDbUnit(getClass(), "keep_authorized_users_for_role_and_project_for_anonymous.xml");
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project1 = db.components().insertPublicProject(organization);
+    ComponentDto project2 = db.components().insertPublicProject(organization);
+    ComponentDto project3 = db.components().insertPublicProject(organization);
+    UserDto user1 = db.users().insertUser("u1");
+    UserDto user2 = db.users().insertUser("u2");
+    UserDto user3 = db.users().insertUser("u3");
+    GroupDto group1 = db.users().insertGroup(organization);
+    GroupDto group2 = db.users().insertGroup(organization);
+    db.users().insertMembers(group1, user1, user2);
+    db.users().insertMembers(group2, user3);
+    db.users().insertProjectPermissionOnUser(user1, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user2, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnUser(user3, UserRole.USER, project1);
+    db.users().insertProjectPermissionOnAnyone(UserRole.USER, project2);
+    db.users().insertProjectPermissionOnGroup(group2, UserRole.USER, project3);
 
     assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession,
       // Only 100 and 101 has 'user' role on project
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/anonymous_should_be_authorized.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/anonymous_should_be_authorized.xml
deleted file mode 100644 (file)
index cdf2e06..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<dataset>
-
-  <user_roles id="1"
-              user_id="100"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-  <groups_users user_id="100"
-                group_id="200"/>
-  <group_roles id="1"
-               group_id="[null]"
-               resource_id="300"
-               role="user"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="[null]"
-               resource_id="400"
-               role="user"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="301"
-            kee="pj-w-snapshot:package"
-            root_uuid="EDFG"
-            project_uuid="EDFG"
-            uuid="ABCD"
-            uuid_path="NOT_USED"
-            module_uuid="EDFG"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="302"
-            kee="pj-w-snapshot:file"
-            root_uuid="EDFG"
-            project_uuid="EDFG"
-            uuid="BCDE"
-            uuid_path="NOT_USED"
-            module_uuid="EDFG"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="303"
-            kee="pj-w-snapshot:other"
-            root_uuid="EDFG"
-            project_uuid="EDFG"
-            uuid="CDEF"
-            uuid_path="NOT_USED"
-            module_uuid="EDFG"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="EDFG"
-            uuid_path="NOT_USED"
-            root_uuid="EDFG"
-            project_uuid="EDFG"
-            module_uuid="[null]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="FGHI"
-            uuid_path="NOT_USED"
-            root_uuid="FGHI"
-            project_uuid="FGHI"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/group_should_be_authorized.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/group_should_be_authorized.xml
deleted file mode 100644 (file)
index 93980ad..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<dataset>
-
-  <!-- user 100 has no direct grant access, but is in the group 200 that has the role "user"
-  on the project 300  -->
-  <user_roles id="1"
-              user_id="100"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-  <groups_users user_id="100"
-                group_id="200"/>
-  <group_roles id="1"
-               group_id="200"
-               resource_id="300"
-               role="user"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="200"
-               resource_id="400"
-               role="user"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="301"
-            kee="pj-w-snapshot:package"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            uuid="ABCD"
-            uuid_path="NOT_USED"
-            module_uuid="DEFG"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="302"
-            kee="pj-w-snapshot:file"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            uuid="BCDE"
-            uuid_path="NOT_USED"
-            module_uuid="DEFG"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="303"
-            kee="pj-w-snapshot:other"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            uuid="CDEF"
-            uuid_path="NOT_USED"
-            module_uuid="DEFG"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml
deleted file mode 100644 (file)
index 569cce1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<dataset>
-
-  <groups_users user_id="100"
-                group_id="200"/>
-  <group_roles id="1"
-               group_id="[null]"
-               resource_id="300"
-               role="user"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="200"
-               resource_id="400"
-               role="codeviewer"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            enabled="[true]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            enabled="[true]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml
deleted file mode 100644 (file)
index 8e18ea4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<dataset>
-
-  <groups_users user_id="100"
-                group_id="200"/>
-  <group_roles id="1"
-               group_id="200"
-               resource_id="300"
-               role="user"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="200"
-               resource_id="400"
-               role="codeviewer"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            enabled="[true]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            enabled="[true]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml
deleted file mode 100644 (file)
index 28599d8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<dataset>
-
-  <!-- user 100 has the role "user" on the project 300 -->
-  <user_roles id="1"
-              user_id="100"
-              resource_id="300"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="2"
-              user_id="100"
-              resource_id="400"
-              role="codeviewer"
-              organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            enabled="[true]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            enabled="[true]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml
deleted file mode 100644 (file)
index 5574214..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<dataset>
-
-  <!-- users 100 and 101 have no direct grant access, but are in the group 200 that has the role "user" on the project 300  -->
-  <user_roles id="1"
-              user_id="100"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="2"
-              user_id="101"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="3"
-              user_id="102"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-
-  <groups_users user_id="100"
-                group_id="200"/>
-  <groups_users user_id="101"
-                group_id="200"/>
-  <groups_users user_id="102"
-                group_id="201"/>
-
-  <group_roles id="1"
-               group_id="[null]"
-               resource_id="300"
-               role="user"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="201"
-               resource_id="400"
-               role="user"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml
deleted file mode 100644 (file)
index 8c9cbbf..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<dataset>
-
-  <!-- users 100 and 101 have no direct grant access, but are in the group 200 that has the role "user" on the project 300  -->
-  <user_roles id="1"
-              user_id="100"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="2"
-              user_id="101"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="3"
-              user_id="102"
-              resource_id="999"
-              role="user"
-              organization_uuid="org1"/>
-
-  <groups_users user_id="100"
-                group_id="200"/>
-  <groups_users user_id="101"
-                group_id="200"/>
-  <groups_users user_id="102"
-                group_id="201"/>
-
-  <group_roles id="1"
-               group_id="200"
-               resource_id="300"
-               role="user"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="201"
-               resource_id="400"
-               role="user"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml
deleted file mode 100644 (file)
index 651d685..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<dataset>
-
-  <!-- Users 100 and 101 are 'user' on project 300 -->
-  <user_roles id="1"
-              user_id="100"
-              resource_id="300"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="2"
-              user_id="101"
-              resource_id="300"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="3"
-              user_id="102"
-              resource_id="300"
-              role="admin"
-              organization_uuid="org1"/>
-  <user_roles id="4"
-              user_id="100"
-              resource_id="400"
-              role="user"
-              organization_uuid="org1"/>
-
-  <groups_users user_id="100"
-                group_id="200"/>
-  <group_roles id="1"
-               group_id="200"
-               resource_id="400"
-               role="user"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            private="[false]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/user_should_be_authorized.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/user_should_be_authorized.xml
deleted file mode 100644 (file)
index 83ef227..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<dataset>
-
-  <!-- user 100 has the role "user" on the project 300 and in group 200 -->
-  <user_roles id="1"
-              user_id="100"
-              resource_id="300"
-              role="user"
-              organization_uuid="org1"/>
-  <user_roles id="2"
-              user_id="100"
-              resource_id="400"
-              role="user"
-              organization_uuid="org1"/>
-  <groups_users user_id="100"
-                group_id="200"/>
-  <group_roles id="1"
-               group_id="200"
-               resource_id="999"
-               role="user"
-               organization_uuid="org1"/>
-
-  <projects organization_uuid="org1"
-            id="300"
-            kee="pj-w-snapshot"
-            uuid="DEFG"
-            uuid_path="NOT_USED"
-            root_uuid="DEFG"
-            project_uuid="DEFG"
-            module_uuid="[null]"
-            private="[false]"/>
-  <projects organization_uuid="org1"
-            id="400"
-            kee="pj-wo-snapshot"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            private="[false]"/>
-</dataset>