Test fix after adding email group to bootstrap

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7377 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2007-11-13 12:21:56 +00:00
parent 306e626cec
commit 5713632748

View File

@@ -144,7 +144,8 @@ public class AuthorityServiceTest extends TestCase
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.EVERYONE).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.EVERYONE).size());
assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.EVERYONE).contains( assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.EVERYONE).contains(
PermissionService.ALL_AUTHORITIES)); PermissionService.ALL_AUTHORITIES));
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); // group added for email
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertFalse(pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).contains( assertFalse(pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).contains(
PermissionService.ALL_AUTHORITIES)); PermissionService.ALL_AUTHORITIES));
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).size());
@@ -225,14 +226,14 @@ public class AuthorityServiceTest extends TestCase
{ {
String auth; String auth;
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "woof");
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "woof");
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth); pubAuthorityService.deleteAuthority(auth);
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size()); assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.ROLE).size()); assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.ROLE).size());
@@ -253,40 +254,40 @@ public class AuthorityServiceTest extends TestCase
String auth5; String auth5;
assertFalse(pubAuthorityService.authorityExists(pubAuthorityService.getName(AuthorityType.GROUP, "one"))); assertFalse(pubAuthorityService.authorityExists(pubAuthorityService.getName(AuthorityType.GROUP, "one")));
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one"); auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertTrue(pubAuthorityService.authorityExists(auth1)); assertTrue(pubAuthorityService.authorityExists(auth1));
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three"); auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four"); auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three");
assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five"); auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five");
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth5); pubAuthorityService.deleteAuthority(auth5);
assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth4); pubAuthorityService.deleteAuthority(auth4);
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth3); pubAuthorityService.deleteAuthority(auth3);
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth2);
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth2); pubAuthorityService.deleteAuthority(auth1);
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
pubAuthorityService.deleteAuthority(auth1);
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size()); assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.ROLE).size()); assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.ROLE).size());
@@ -333,33 +334,33 @@ public class AuthorityServiceTest extends TestCase
String auth4; String auth4;
String auth5; String auth5;
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertEquals("GROUP_one", auth1);
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two"); auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertEquals("GROUP_two", auth2); assertEquals("GROUP_one", auth1);
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
assertEquals("GROUP_two", auth2);
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three"); auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three");
assertEquals("GROUP_three", auth3); assertEquals("GROUP_three", auth3);
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four"); auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four");
assertEquals("GROUP_four", auth4); assertEquals("GROUP_four", auth4);
assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five"); auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five");
assertEquals("GROUP_five", auth5); assertEquals("GROUP_five", auth5);
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
pubAuthorityService.addAuthority(auth5, "andy"); pubAuthorityService.addAuthority(auth5, "andy");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
// The next call looks for people not users :-) // The next call looks for people not users :-)
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy", false).size()); assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
@@ -376,8 +377,8 @@ public class AuthorityServiceTest extends TestCase
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth5, false).contains("andy")); assertTrue(pubAuthorityService.getContainedAuthorities(null, auth5, false).contains("andy"));
pubAuthorityService.removeAuthority(auth5, "andy"); pubAuthorityService.removeAuthority(auth5, "andy");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
// The next call looks for people not users :-) // The next call looks for people not users :-)
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
assertEquals(0, pubAuthorityService.getContainingAuthorities(null, "andy", false).size()); assertEquals(0, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
@@ -400,30 +401,30 @@ public class AuthorityServiceTest extends TestCase
String auth4; String auth4;
String auth5; String auth5;
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two"); auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three"); auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four"); auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three");
assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five"); auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five");
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
pubAuthorityService.addAuthority(auth5, "andy"); pubAuthorityService.addAuthority(auth5, "andy");
pubAuthorityService.addAuthority(auth1, "andy"); pubAuthorityService.addAuthority(auth1, "andy");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
// The next call looks for people not users :-) // The next call looks for people not users :-)
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy", false).size()); assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
@@ -441,8 +442,8 @@ public class AuthorityServiceTest extends TestCase
pubAuthorityService.removeAuthority(auth1, "andy"); pubAuthorityService.removeAuthority(auth1, "andy");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
// The next call looks for people not users :-) // The next call looks for people not users :-)
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy", false).size()); assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
@@ -467,30 +468,30 @@ public class AuthorityServiceTest extends TestCase
String auth4; String auth4;
String auth5; String auth5;
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two"); auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three"); auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four"); auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "three");
assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(4, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five"); auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "four");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "five");
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
pubAuthorityService.addAuthority(auth5, "andy"); pubAuthorityService.addAuthority(auth5, "andy");
pubAuthorityService.addAuthority(auth1, "andy"); pubAuthorityService.addAuthority(auth1, "andy");
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
// The next call looks for people not users :-) // The next call looks for people not users :-)
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy", false).size()); assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
@@ -509,8 +510,8 @@ public class AuthorityServiceTest extends TestCase
pubAuthorityService.addAuthority(auth3, auth2); pubAuthorityService.addAuthority(auth3, auth2);
assertEquals(5, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(2, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
// The next call looks for people not users :-) // The next call looks for people not users :-)
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size()); assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
assertEquals(4, pubAuthorityService.getContainingAuthorities(null, "andy", false).size()); assertEquals(4, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
@@ -540,8 +541,8 @@ public class AuthorityServiceTest extends TestCase
personService.getPerson("andy4"); personService.getPerson("andy4");
personService.getPerson("andy5"); personService.getPerson("andy5");
personService.getPerson("andy6"); personService.getPerson("andy6");
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
String auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one"); String auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
pubAuthorityService.addAuthority(auth1, "andy1"); pubAuthorityService.addAuthority(auth1, "andy1");
String auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "two"); String auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "two");
@@ -718,8 +719,8 @@ public class AuthorityServiceTest extends TestCase
assertTrue(personService.personExists("an3dy")); assertTrue(personService.personExists("an3dy"));
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
String auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one"); String auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
pubAuthorityService.addAuthority(auth1, "1234"); pubAuthorityService.addAuthority(auth1, "1234");
String auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two"); String auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
@@ -765,8 +766,8 @@ public class AuthorityServiceTest extends TestCase
public void testGroupNameTokenisation() public void testGroupNameTokenisation()
{ {
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
String auth1234 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "1234"); String auth1234 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "1234");
assertEquals(0, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth1234, false).size()); assertEquals(0, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth1234, false).size());
@@ -795,8 +796,8 @@ public class AuthorityServiceTest extends TestCase
pubAuthorityService.deleteAuthority(authC1); pubAuthorityService.deleteAuthority(authC1);
pubAuthorityService.deleteAuthority(auth1234); pubAuthorityService.deleteAuthority(auth1234);
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size()); assertEquals(1, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
} }
private Map<QName, Serializable> createDefaultProperties(String userName, String firstName, String lastName, private Map<QName, Serializable> createDefaultProperties(String userName, String firstName, String lastName,