Fix issues with move of TestingAuthenticationToken
This commit is contained in:
parent
aa75b2fa6d
commit
4165e15861
|
@ -9,7 +9,6 @@
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-acl</artifactId>
|
<artifactId>spring-security-acl</artifactId>
|
||||||
<name>Spring Security - ACL module</name>
|
<name>Spring Security - ACL module</name>
|
||||||
<version>2.0.4-SNAPSHOT</version>
|
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -25,6 +24,13 @@
|
||||||
<classifier>tests</classifier>
|
<classifier>tests</classifier>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class SidTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Authentication authentication = new TestingAuthenticationToken(null, "password", null);
|
Authentication authentication = new TestingAuthenticationToken(null, "password");
|
||||||
Sid principalSid = new PrincipalSid(authentication);
|
Sid principalSid = new PrincipalSid(authentication);
|
||||||
Assert.fail("It should have thrown IllegalArgumentException");
|
Assert.fail("It should have thrown IllegalArgumentException");
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class SidTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
|
Authentication authentication = new TestingAuthenticationToken("johndoe", "password");
|
||||||
Sid principalSid = new PrincipalSid(authentication);
|
Sid principalSid = new PrincipalSid(authentication);
|
||||||
Assert.assertTrue(true);
|
Assert.assertTrue(true);
|
||||||
}
|
}
|
||||||
|
@ -128,15 +128,15 @@ public class SidTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPrincipalSidEquals() throws Exception {
|
public void testPrincipalSidEquals() throws Exception {
|
||||||
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
|
Authentication authentication = new TestingAuthenticationToken("johndoe", "password");
|
||||||
Sid principalSid = new PrincipalSid(authentication);
|
Sid principalSid = new PrincipalSid(authentication);
|
||||||
|
|
||||||
Assert.assertFalse(principalSid.equals(null));
|
Assert.assertFalse(principalSid.equals(null));
|
||||||
Assert.assertFalse(principalSid.equals("DIFFERENT_TYPE_OBJECT"));
|
Assert.assertFalse(principalSid.equals("DIFFERENT_TYPE_OBJECT"));
|
||||||
Assert.assertTrue(principalSid.equals(principalSid));
|
Assert.assertTrue(principalSid.equals(principalSid));
|
||||||
Assert.assertTrue(principalSid.equals(new PrincipalSid(authentication)));
|
Assert.assertTrue(principalSid.equals(new PrincipalSid(authentication)));
|
||||||
Assert.assertTrue(principalSid.equals(new PrincipalSid(new TestingAuthenticationToken("johndoe", null, null))));
|
Assert.assertTrue(principalSid.equals(new PrincipalSid(new TestingAuthenticationToken("johndoe", null))));
|
||||||
Assert.assertFalse(principalSid.equals(new PrincipalSid(new TestingAuthenticationToken("scott", null, null))));
|
Assert.assertFalse(principalSid.equals(new PrincipalSid(new TestingAuthenticationToken("scott", null))));
|
||||||
Assert.assertTrue(principalSid.equals(new PrincipalSid("johndoe")));
|
Assert.assertTrue(principalSid.equals(new PrincipalSid("johndoe")));
|
||||||
Assert.assertFalse(principalSid.equals(new PrincipalSid("scott")));
|
Assert.assertFalse(principalSid.equals(new PrincipalSid("scott")));
|
||||||
}
|
}
|
||||||
|
@ -156,14 +156,13 @@ public class SidTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPrincipalSidHashCode() throws Exception {
|
public void testPrincipalSidHashCode() throws Exception {
|
||||||
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
|
Authentication authentication = new TestingAuthenticationToken("johndoe", "password");
|
||||||
Sid principalSid = new PrincipalSid(authentication);
|
Sid principalSid = new PrincipalSid(authentication);
|
||||||
|
|
||||||
Assert.assertTrue(principalSid.hashCode() == new String("johndoe").hashCode());
|
Assert.assertTrue(principalSid.hashCode() == new String("johndoe").hashCode());
|
||||||
Assert.assertTrue(principalSid.hashCode() == new PrincipalSid("johndoe").hashCode());
|
Assert.assertTrue(principalSid.hashCode() == new PrincipalSid("johndoe").hashCode());
|
||||||
Assert.assertTrue(principalSid.hashCode() != new PrincipalSid("scott").hashCode());
|
Assert.assertTrue(principalSid.hashCode() != new PrincipalSid("scott").hashCode());
|
||||||
Assert.assertTrue(principalSid.hashCode() != new PrincipalSid(new TestingAuthenticationToken("scott", "password",
|
Assert.assertTrue(principalSid.hashCode() != new PrincipalSid(new TestingAuthenticationToken("scott", "password")).hashCode());
|
||||||
null)).hashCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGrantedAuthoritySidHashCode() throws Exception {
|
public void testGrantedAuthoritySidHashCode() throws Exception {
|
||||||
|
@ -177,7 +176,7 @@ public class SidTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetters() throws Exception {
|
public void testGetters() throws Exception {
|
||||||
Authentication authentication = new TestingAuthenticationToken("johndoe", "password", null);
|
Authentication authentication = new TestingAuthenticationToken("johndoe", "password");
|
||||||
PrincipalSid principalSid = new PrincipalSid(authentication);
|
PrincipalSid principalSid = new PrincipalSid(authentication);
|
||||||
GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST");
|
GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_TEST");
|
||||||
GrantedAuthoritySid gaSid = new GrantedAuthoritySid(ga);
|
GrantedAuthoritySid gaSid = new GrantedAuthoritySid(ga);
|
||||||
|
|
Loading…
Reference in New Issue