Merged 5.2.N (5.2.1) to HEAD (5.2)

128332 adavis: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
      128253 adavis: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)
         128241 adavis: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
            128225 adavis: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.7)
               128166 amorarasu: Merged V4.1.9 (4.1.9.16) to V4.1-BUG-FIX (4.1.11)
                  128155 amorarasu: MNT-16316: GET /alfresco/service/api/groups API slow performance when the 'zone' filter is used.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129283 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alexandru Epure
2016-08-09 13:55:31 +00:00
parent c06c9a208a
commit 43724e8ec6
6 changed files with 121 additions and 51 deletions

View File

@@ -1516,6 +1516,35 @@ public class AuthorityServiceTest extends TestCase
*/
}
public void testGetAuthoritiesForZone()
{
String role = pubAuthorityService.createAuthority(AuthorityType.ROLE, "one");
String group = pubAuthorityService.createAuthority(AuthorityType.GROUP, "group1");
String user = "user@" + System.currentTimeMillis();
createUserAuthority(user);
PagingResults<String> authorities = authorityService.getAuthorities(null, AuthorityService.ZONE_APP_DEFAULT, "*", false, false, new PagingRequest(100));
assertTrue(authorities.getPage().contains(user));
assertTrue(authorities.getPage().contains(role));
assertTrue(authorities.getPage().contains(group));
PagingResults<String> groups = authorityService.getAuthorities(AuthorityType.GROUP, AuthorityService.ZONE_APP_DEFAULT, "*", false, false, new PagingRequest(100));
assertTrue(groups.getPage().contains(group));
assertFalse(groups.getPage().contains(user));
assertFalse(groups.getPage().contains(role));
}
private void createUserAuthority(String user)
{
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4, 1.0f);
props.put(ContentModel.PROP_USERNAME, user);
props.put(ContentModel.PROP_FIRSTNAME, user);
props.put(ContentModel.PROP_LASTNAME, user);
props.put(ContentModel.PROP_EMAIL, user + "@gmail.com");
personService.createPerson(props);
authenticationService.createAuthentication(user, "123123".toCharArray());
}
private void assertContains(List<String> results, List<String> checklist, boolean included)
{
for (String check : checklist)