|
@@ -54,7 +54,7 @@ public class AclImplTests {
|
|
|
// ========================================================================================================
|
|
|
|
|
|
@Before
|
|
|
- public void setUp() throws Exception {
|
|
|
+ public void setUp() {
|
|
|
SecurityContextHolder.getContext().setAuthentication(auth);
|
|
|
authzStrategy = mock(AclAuthorizationStrategy.class);
|
|
|
mockAuditLogger = mock(AuditLogger.class);
|
|
@@ -63,12 +63,12 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@After
|
|
|
- public void tearDown() throws Exception {
|
|
|
+ public void tearDown() {
|
|
|
SecurityContextHolder.clearContext();
|
|
|
}
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
|
- public void constructorsRejectNullObjectIdentity() throws Exception {
|
|
|
+ public void constructorsRejectNullObjectIdentity() {
|
|
|
try {
|
|
|
new AclImpl(null, 1, authzStrategy, pgs, null, null, true, new PrincipalSid(
|
|
|
"joe"));
|
|
@@ -80,7 +80,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
|
- public void constructorsRejectNullId() throws Exception {
|
|
|
+ public void constructorsRejectNullId() {
|
|
|
try {
|
|
|
new AclImpl(objectIdentity, null, authzStrategy, pgs, null, null, true,
|
|
|
new PrincipalSid("joe"));
|
|
@@ -93,7 +93,7 @@ public class AclImplTests {
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
|
- public void constructorsRejectNullAclAuthzStrategy() throws Exception {
|
|
|
+ public void constructorsRejectNullAclAuthzStrategy() {
|
|
|
try {
|
|
|
new AclImpl(objectIdentity, 1, null, new DefaultPermissionGrantingStrategy(
|
|
|
mockAuditLogger), null, null, true, new PrincipalSid("joe"));
|
|
@@ -105,7 +105,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void insertAceRejectsNullParameters() throws Exception {
|
|
|
+ public void insertAceRejectsNullParameters() {
|
|
|
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
try {
|
|
@@ -123,7 +123,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void insertAceAddsElementAtCorrectIndex() throws Exception {
|
|
|
+ public void insertAceAddsElementAtCorrectIndex() {
|
|
|
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
MockAclService service = new MockAclService();
|
|
@@ -166,7 +166,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test(expected = NotFoundException.class)
|
|
|
- public void insertAceFailsForNonExistentElement() throws Exception {
|
|
|
+ public void insertAceFailsForNonExistentElement() {
|
|
|
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
MockAclService service = new MockAclService();
|
|
@@ -180,7 +180,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void deleteAceKeepsInitialOrdering() throws Exception {
|
|
|
+ public void deleteAceKeepsInitialOrdering() {
|
|
|
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
MockAclService service = new MockAclService();
|
|
@@ -217,7 +217,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void deleteAceFailsForNonExistentElement() throws Exception {
|
|
|
+ public void deleteAceFailsForNonExistentElement() {
|
|
|
AclAuthorizationStrategyImpl strategy = new AclAuthorizationStrategyImpl(
|
|
|
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
|
|
|
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
|
|
@@ -232,7 +232,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void isGrantingRejectsEmptyParameters() throws Exception {
|
|
|
+ public void isGrantingRejectsEmptyParameters() {
|
|
|
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
Sid ben = new PrincipalSid("ben");
|
|
@@ -251,7 +251,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void isGrantingGrantsAccessForAclWithNoParent() throws Exception {
|
|
|
+ public void isGrantingGrantsAccessForAclWithNoParent() {
|
|
|
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
|
|
"ROLE_GENERAL", "ROLE_GUEST");
|
|
|
auth.setAuthenticated(true);
|
|
@@ -297,7 +297,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void isGrantingGrantsAccessForInheritableAcls() throws Exception {
|
|
|
+ public void isGrantingGrantsAccessForInheritableAcls() {
|
|
|
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
|
|
"ROLE_GENERAL");
|
|
|
auth.setAuthenticated(true);
|
|
@@ -379,7 +379,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void updatedAceValuesAreCorrectlyReflectedInAcl() throws Exception {
|
|
|
+ public void updatedAceValuesAreCorrectlyReflectedInAcl() {
|
|
|
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
|
|
"ROLE_GENERAL");
|
|
|
auth.setAuthenticated(true);
|
|
@@ -411,7 +411,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void auditableEntryFlagsAreUpdatedCorrectly() throws Exception {
|
|
|
+ public void auditableEntryFlagsAreUpdatedCorrectly() {
|
|
|
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
|
|
"ROLE_AUDITING", "ROLE_GENERAL");
|
|
|
auth.setAuthenticated(true);
|
|
@@ -449,7 +449,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void gettersAndSettersAreConsistent() throws Exception {
|
|
|
+ public void gettersAndSettersAreConsistent() {
|
|
|
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
|
|
"ROLE_GENERAL");
|
|
|
auth.setAuthenticated(true);
|
|
@@ -485,7 +485,7 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void isSidLoadedBehavesAsExpected() throws Exception {
|
|
|
+ public void isSidLoadedBehavesAsExpected() {
|
|
|
List<Sid> loadedSids = Arrays.asList(new PrincipalSid("ben"),
|
|
|
new GrantedAuthoritySid("ROLE_IGNORED"));
|
|
|
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null,
|
|
@@ -513,22 +513,21 @@ public class AclImplTests {
|
|
|
}
|
|
|
|
|
|
@Test(expected = NotFoundException.class)
|
|
|
- public void insertAceRaisesNotFoundExceptionForIndexLessThanZero() throws Exception {
|
|
|
+ public void insertAceRaisesNotFoundExceptionForIndexLessThanZero() {
|
|
|
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
acl.insertAce(-1, mock(Permission.class), mock(Sid.class), true);
|
|
|
}
|
|
|
|
|
|
@Test(expected = NotFoundException.class)
|
|
|
- public void deleteAceRaisesNotFoundExceptionForIndexLessThanZero() throws Exception {
|
|
|
+ public void deleteAceRaisesNotFoundExceptionForIndexLessThanZero() {
|
|
|
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
acl.deleteAce(-1);
|
|
|
}
|
|
|
|
|
|
@Test(expected = NotFoundException.class)
|
|
|
- public void insertAceRaisesNotFoundExceptionForIndexGreaterThanSize()
|
|
|
- throws Exception {
|
|
|
+ public void insertAceRaisesNotFoundExceptionForIndexGreaterThanSize() {
|
|
|
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
// Insert at zero, OK.
|
|
@@ -539,7 +538,7 @@ public class AclImplTests {
|
|
|
|
|
|
// SEC-1151
|
|
|
@Test(expected = NotFoundException.class)
|
|
|
- public void deleteAceRaisesNotFoundExceptionForIndexEqualToSize() throws Exception {
|
|
|
+ public void deleteAceRaisesNotFoundExceptionForIndexEqualToSize() {
|
|
|
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
|
|
true, new PrincipalSid("joe"));
|
|
|
acl.insertAce(0, mock(Permission.class), mock(Sid.class), true);
|
|
@@ -549,7 +548,7 @@ public class AclImplTests {
|
|
|
|
|
|
// SEC-1795
|
|
|
@Test
|
|
|
- public void changingParentIsSuccessful() throws Exception {
|
|
|
+ public void changingParentIsSuccessful() {
|
|
|
AclImpl parentAcl = new AclImpl(objectIdentity, 1L, authzStrategy,
|
|
|
mockAuditLogger);
|
|
|
AclImpl childAcl = new AclImpl(objectIdentity, 2L, authzStrategy, mockAuditLogger);
|