This commit is contained in:
Andrei Stefan 2008-01-29 18:36:22 +00:00
parent f121b6ac90
commit 00b5c0e61b
7 changed files with 27 additions and 27 deletions

View File

@ -12,7 +12,7 @@ public class AclFormattingUtilsTests extends TestCase {
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
public final void testDemergePatternsParametersConstraints() { public final void testDemergePatternsParametersConstraints() throws Exception {
try { try {
AclFormattingUtils.demergePatterns(null, "SOME STRING"); AclFormattingUtils.demergePatterns(null, "SOME STRING");
Assert.fail("It should have thrown IllegalArgumentException"); Assert.fail("It should have thrown IllegalArgumentException");
@ -46,7 +46,7 @@ public class AclFormattingUtilsTests extends TestCase {
} }
} }
public final void testDemergePatterns() { public final void testDemergePatterns() throws Exception {
String original = "...........................A...R"; String original = "...........................A...R";
String removeBits = "...............................R"; String removeBits = "...............................R";
Assert.assertEquals("...........................A....", AclFormattingUtils Assert.assertEquals("...........................A....", AclFormattingUtils
@ -56,7 +56,7 @@ public class AclFormattingUtilsTests extends TestCase {
Assert.assertEquals("......", AclFormattingUtils.demergePatterns("ABCDEF", "GHIJKL")); Assert.assertEquals("......", AclFormattingUtils.demergePatterns("ABCDEF", "GHIJKL"));
} }
public final void testMergePatternsParametersConstraints() { public final void testMergePatternsParametersConstraints() throws Exception {
try { try {
AclFormattingUtils.mergePatterns(null, "SOME STRING"); AclFormattingUtils.mergePatterns(null, "SOME STRING");
Assert.fail("It should have thrown IllegalArgumentException"); Assert.fail("It should have thrown IllegalArgumentException");
@ -90,7 +90,7 @@ public class AclFormattingUtilsTests extends TestCase {
} }
} }
public final void testMergePatterns() { public final void testMergePatterns() throws Exception {
String original = "...............................R"; String original = "...............................R";
String extraBits = "...........................A...."; String extraBits = "...........................A....";
Assert.assertEquals("...........................A...R", AclFormattingUtils Assert.assertEquals("...........................A...R", AclFormattingUtils
@ -100,7 +100,7 @@ public class AclFormattingUtilsTests extends TestCase {
Assert.assertEquals("GHIJKL", AclFormattingUtils.mergePatterns("ABCDEF", "GHIJKL")); Assert.assertEquals("GHIJKL", AclFormattingUtils.mergePatterns("ABCDEF", "GHIJKL"));
} }
public final void testBinaryPrints() { public final void testBinaryPrints() throws Exception {
Assert.assertEquals("............................****", AclFormattingUtils.printBinary(15)); Assert.assertEquals("............................****", AclFormattingUtils.printBinary(15));
try { try {

View File

@ -22,7 +22,7 @@ public class AccessControlEntryTests extends TestCase {
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
public void testConstructorRequiredFields() { public void testConstructorRequiredFields() throws Exception {
// Check Acl field is present // Check Acl field is present
try { try {
AccessControlEntry ace = new AccessControlEntryImpl(null, null, new PrincipalSid("johndoe"), AccessControlEntry ace = new AccessControlEntryImpl(null, null, new PrincipalSid("johndoe"),
@ -54,7 +54,7 @@ public class AccessControlEntryTests extends TestCase {
} }
} }
public void testAccessControlEntryImplGetters() { public void testAccessControlEntryImplGetters() throws Exception {
Acl mockAcl = new MockAcl(); Acl mockAcl = new MockAcl();
Sid sid = new PrincipalSid("johndoe"); Sid sid = new PrincipalSid("johndoe");
@ -72,7 +72,7 @@ public class AccessControlEntryTests extends TestCase {
Assert.assertTrue(((AuditableAccessControlEntry) ace).isAuditSuccess()); Assert.assertTrue(((AuditableAccessControlEntry) ace).isAuditSuccess());
} }
public void testEquals() { public void testEquals() throws Exception {
Acl mockAcl = new MockAcl(); Acl mockAcl = new MockAcl();
Sid sid = new PrincipalSid("johndoe"); Sid sid = new PrincipalSid("johndoe");

View File

@ -34,7 +34,7 @@ public class AclImplementationSecurityCheckTests extends TestCase {
SecurityContextHolder.clearContext(); SecurityContextHolder.clearContext();
} }
public void testSecurityCheckNoACEs() { public void testSecurityCheckNoACEs() throws Exception {
Authentication auth = new TestingAuthenticationToken("user", "password", new GrantedAuthority[] { Authentication auth = new TestingAuthenticationToken("user", "password", new GrantedAuthority[] {
new GrantedAuthorityImpl("ROLE_GENERAL"), new GrantedAuthorityImpl("ROLE_AUDITING"), new GrantedAuthorityImpl("ROLE_GENERAL"), new GrantedAuthorityImpl("ROLE_AUDITING"),
new GrantedAuthorityImpl("ROLE_OWNERSHIP") }); new GrantedAuthorityImpl("ROLE_OWNERSHIP") });
@ -98,7 +98,7 @@ public class AclImplementationSecurityCheckTests extends TestCase {
} }
} }
public void testSecurityCheckWithMultipleACEs() { public void testSecurityCheckWithMultipleACEs() throws Exception {
// Create a simple authentication with ROLE_GENERAL // Create a simple authentication with ROLE_GENERAL
Authentication auth = new TestingAuthenticationToken("user", "password", Authentication auth = new TestingAuthenticationToken("user", "password",
new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_GENERAL") }); new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_GENERAL") });
@ -199,7 +199,7 @@ public class AclImplementationSecurityCheckTests extends TestCase {
} }
} }
public void testSecurityCheckWithInheritableACEs() { public void testSecurityCheckWithInheritableACEs() throws Exception {
// Create a simple authentication with ROLE_GENERAL // Create a simple authentication with ROLE_GENERAL
Authentication auth = new TestingAuthenticationToken("user", "password", Authentication auth = new TestingAuthenticationToken("user", "password",
new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_GENERAL") }); new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_GENERAL") });
@ -257,7 +257,7 @@ public class AclImplementationSecurityCheckTests extends TestCase {
} }
} }
public void testSecurityCheckPrincipalOwner() { public void testSecurityCheckPrincipalOwner() throws Exception {
Authentication auth = new TestingAuthenticationToken("user", "password", new GrantedAuthority[] { Authentication auth = new TestingAuthenticationToken("user", "password", new GrantedAuthority[] {
new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl("ROLE_ONE"),
new GrantedAuthorityImpl("ROLE_ONE") }); new GrantedAuthorityImpl("ROLE_ONE") });

View File

@ -36,7 +36,7 @@ public class AuditLoggerTests extends TestCase {
System.setOut(console); System.setOut(console);
} }
public void testLoggingTests() { public void testLoggingTests() throws Exception {
ConsoleAuditLogger logger = new ConsoleAuditLogger(); ConsoleAuditLogger logger = new ConsoleAuditLogger();
MockAccessControlEntryImpl auditableAccessControlEntry = new MockAccessControlEntryImpl(); MockAccessControlEntryImpl auditableAccessControlEntry = new MockAccessControlEntryImpl();

View File

@ -14,7 +14,7 @@ public class ObjectIdentityTests extends TestCase {
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
public void testConstructorsRequiredFields() { public void testConstructorsRequiredFields() throws Exception {
// Check one-argument constructor required field // Check one-argument constructor required field
try { try {
ObjectIdentity obj = new ObjectIdentityImpl(null); ObjectIdentity obj = new ObjectIdentityImpl(null);
@ -64,7 +64,7 @@ public class ObjectIdentityTests extends TestCase {
} }
} }
public void testGetIdMethodConstraints() { public void testGetIdMethodConstraints() throws Exception {
// Check the getId() method is present // Check the getId() method is present
try { try {
ObjectIdentity obj = new ObjectIdentityImpl("A_STRING_OBJECT"); ObjectIdentity obj = new ObjectIdentityImpl("A_STRING_OBJECT");
@ -105,7 +105,7 @@ public class ObjectIdentityTests extends TestCase {
} }
} }
public void testConstructorInvalidClassParameter() { public void testConstructorInvalidClassParameter() throws Exception {
try { try {
ObjectIdentity obj = new ObjectIdentityImpl("not.a.Class", new Long(1)); ObjectIdentity obj = new ObjectIdentityImpl("not.a.Class", new Long(1));
} }
@ -115,7 +115,7 @@ public class ObjectIdentityTests extends TestCase {
Assert.fail("It should have thrown IllegalStateException"); Assert.fail("It should have thrown IllegalStateException");
} }
public void testEquals() { public void testEquals() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl( ObjectIdentity obj = new ObjectIdentityImpl(
"org.springframework.security.acls.objectidentity.ObjectIdentityTests$MockIdDomainObject", new Long(1)); "org.springframework.security.acls.objectidentity.ObjectIdentityTests$MockIdDomainObject", new Long(1));
MockIdDomainObject mockObj = new MockIdDomainObject(); MockIdDomainObject mockObj = new MockIdDomainObject();
@ -144,7 +144,7 @@ public class ObjectIdentityTests extends TestCase {
.equals(new ObjectIdentityImpl(mockObj))); .equals(new ObjectIdentityImpl(mockObj)));
} }
public void testHashCode() { public void testHashCode() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl( ObjectIdentity obj = new ObjectIdentityImpl(
"org.springframework.security.acls.objectidentity.ObjectIdentityTests$MockIdDomainObject", new Long(1)); "org.springframework.security.acls.objectidentity.ObjectIdentityTests$MockIdDomainObject", new Long(1));
Assert.assertEquals(new ObjectIdentityImpl( Assert.assertEquals(new ObjectIdentityImpl(
@ -158,7 +158,7 @@ public class ObjectIdentityTests extends TestCase {
.hashCode() != obj.hashCode()); .hashCode() != obj.hashCode());
} }
public void testGetters() { public void testGetters() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl( ObjectIdentity obj = new ObjectIdentityImpl(
"org.springframework.security.acls.objectidentity.ObjectIdentityTests$MockIdDomainObject", new Long(1)); "org.springframework.security.acls.objectidentity.ObjectIdentityTests$MockIdDomainObject", new Long(1));
Assert.assertEquals(new Long(1), obj.getIdentifier()); Assert.assertEquals(new Long(1), obj.getIdentifier());

View File

@ -17,7 +17,7 @@ public class SidRetrievalStrategyTests extends TestCase {
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
public void testSidsRetrieval() { public void testSidsRetrieval() throws Exception {
Authentication authentication = new TestingAuthenticationToken("scott", "password", new GrantedAuthority[] { Authentication authentication = new TestingAuthenticationToken("scott", "password", new GrantedAuthority[] {
new GrantedAuthorityImpl("ROLE_1"), new GrantedAuthorityImpl("ROLE_2"), new GrantedAuthorityImpl("ROLE_3") }); new GrantedAuthorityImpl("ROLE_1"), new GrantedAuthorityImpl("ROLE_2"), new GrantedAuthorityImpl("ROLE_3") });
SidRetrievalStrategy retrStrategy = new SidRetrievalStrategyImpl(); SidRetrievalStrategy retrStrategy = new SidRetrievalStrategyImpl();

View File

@ -15,7 +15,7 @@ public class SidTests extends TestCase {
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
public void testPrincipalSidConstructorsRequiredFields() { public void testPrincipalSidConstructorsRequiredFields() throws Exception {
// Check one String-argument constructor // Check one String-argument constructor
try { try {
String string = null; String string = null;
@ -71,7 +71,7 @@ public class SidTests extends TestCase {
} }
} }
public void testGrantedAuthoritySidConstructorsRequiredFields() { public void testGrantedAuthoritySidConstructorsRequiredFields() throws Exception {
// Check one String-argument constructor // Check one String-argument constructor
try { try {
String string = null; String string = null;
@ -127,7 +127,7 @@ public class SidTests extends TestCase {
} }
} }
public void testPrincipalSidEquals() { public void testPrincipalSidEquals() throws Exception {
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null); Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
Sid principalSid = new PrincipalSid(authentication); Sid principalSid = new PrincipalSid(authentication);
@ -141,7 +141,7 @@ public class SidTests extends TestCase {
Assert.assertFalse(principalSid.equals(new PrincipalSid("scott"))); Assert.assertFalse(principalSid.equals(new PrincipalSid("scott")));
} }
public void testGrantedAuthoritySidEquals() { public void testGrantedAuthoritySidEquals() throws Exception {
GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST"); GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST");
Sid gaSid = new GrantedAuthoritySid(ga); Sid gaSid = new GrantedAuthoritySid(ga);
@ -155,7 +155,7 @@ public class SidTests extends TestCase {
Assert.assertFalse(gaSid.equals(new GrantedAuthoritySid("ROLE_NOT_EQUAL"))); Assert.assertFalse(gaSid.equals(new GrantedAuthoritySid("ROLE_NOT_EQUAL")));
} }
public void testPrincipalSidHashCode() { public void testPrincipalSidHashCode() throws Exception {
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null); Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
Sid principalSid = new PrincipalSid(authentication); Sid principalSid = new PrincipalSid(authentication);
@ -166,7 +166,7 @@ public class SidTests extends TestCase {
null)).hashCode()); null)).hashCode());
} }
public void testGrantedAuthoritySidHashCode() { public void testGrantedAuthoritySidHashCode() throws Exception {
GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST"); GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST");
Sid gaSid = new GrantedAuthoritySid(ga); Sid gaSid = new GrantedAuthoritySid(ga);
@ -176,7 +176,7 @@ public class SidTests extends TestCase {
Assert.assertTrue(gaSid.hashCode() != new GrantedAuthoritySid(new GrantedAuthorityImpl("ROLE_TEST_2")).hashCode()); Assert.assertTrue(gaSid.hashCode() != new GrantedAuthoritySid(new GrantedAuthorityImpl("ROLE_TEST_2")).hashCode());
} }
public void testGetters() { public void testGetters() throws Exception {
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null); Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
PrincipalSid principalSid = new PrincipalSid(authentication); PrincipalSid principalSid = new PrincipalSid(authentication);
GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST"); GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST");