Added a customized checkstyle configuration file to tame the Maven 2 checkstyle report to the extent that it gives some useful infomation. Tidied up comments, excessively long lines, use of tabs etc. to match.
This commit is contained in:
@@ -24,13 +24,13 @@ package org.acegisecurity;
|
||||
public interface ITargetObject {
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public Integer computeHashCode(String input);
|
||||
Integer computeHashCode(String input);
|
||||
|
||||
public int countLength(String input);
|
||||
int countLength(String input);
|
||||
|
||||
public String makeLowerCase(String input);
|
||||
String makeLowerCase(String input);
|
||||
|
||||
public String makeUpperCase(String input);
|
||||
String makeUpperCase(String input);
|
||||
|
||||
public String publicMakeLowerCase(String input);
|
||||
String publicMakeLowerCase(String input);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,10 @@ public class AclProviderManagerTests extends TestCase {
|
||||
new NamedEntityObjectIdentity("OBJECT", "100"), null, 2);
|
||||
private UsernamePasswordAuthenticationToken scott = new UsernamePasswordAuthenticationToken("scott",
|
||||
"not used",
|
||||
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_FOO"), new GrantedAuthorityImpl("ROLE_MANAGER")});
|
||||
new GrantedAuthority[] {
|
||||
new GrantedAuthorityImpl("ROLE_FOO"),
|
||||
new GrantedAuthorityImpl("ROLE_MANAGER")
|
||||
});
|
||||
private SimpleAclEntry entry100Scott = new SimpleAclEntry(scott.getPrincipal(),
|
||||
new NamedEntityObjectIdentity("OBJECT", "100"), null, 4);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class LdapTestServer {
|
||||
|
||||
//~ Constructors ===================================================================================================
|
||||
|
||||
/**
|
||||
/**
|
||||
* Starts up and configures ApacheDS.
|
||||
*/
|
||||
public LdapTestServer() {
|
||||
@@ -212,7 +212,7 @@ public class LdapTestServer {
|
||||
|
||||
String apacheWorkDir = System.getProperty("apacheDSWorkDir");
|
||||
|
||||
if(apacheWorkDir == null) {
|
||||
if (apacheWorkDir == null) {
|
||||
apacheWorkDir = System.getProperty("java.io.tmpdir") + File.separator + "apacheds-work";
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class LdapTestServer {
|
||||
}
|
||||
|
||||
/** Recursively deletes a directory */
|
||||
private static boolean deleteDir(File dir) {
|
||||
private boolean deleteDir(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (int i=0; i<children.length; i++) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testAttemptSwitchToUnknownUser() throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
|
||||
public void testAttemptSwitchToUserThatIsDisabled()
|
||||
throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
@@ -121,7 +121,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
|
||||
public void testAttemptSwitchToUserWithAccountExpired()
|
||||
throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
@@ -144,7 +144,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
|
||||
public void testAttemptSwitchToUserWithExpiredCredentials()
|
||||
throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
@@ -166,7 +166,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testAttemptSwitchUser() throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
@@ -218,7 +218,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testExitRequestUserJackLordToDano() throws Exception {
|
||||
// original user
|
||||
// original user
|
||||
GrantedAuthority[] auths = {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl("ROLE_TWO")};
|
||||
UsernamePasswordAuthenticationToken source = new UsernamePasswordAuthenticationToken("dano", "hawaii50", auths);
|
||||
|
||||
@@ -249,7 +249,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
// run 'exit'
|
||||
filter.doFilter(request, response, chain);
|
||||
|
||||
// check current user, should be back to original user (dano)
|
||||
// check current user, should be back to original user (dano)
|
||||
Authentication targetAuth = SecurityContextHolder.getContext().getAuthentication();
|
||||
assertNotNull(targetAuth);
|
||||
assertEquals("dano", targetAuth.getPrincipal());
|
||||
@@ -273,7 +273,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
|
||||
MockFilterChain chain = new MockFilterChain(true);
|
||||
|
||||
// run 'exit', expect fail due to no current user
|
||||
// run 'exit', expect fail due to no current user
|
||||
try {
|
||||
filter.doFilter(request, response, chain);
|
||||
|
||||
@@ -282,7 +282,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testRedirectToTargetUrl() throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
@@ -327,7 +327,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testSwitchRequestFromDanoToJackLord() throws Exception {
|
||||
// set current user
|
||||
// set current user
|
||||
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
|
||||
@@ -21,100 +21,100 @@ import org.acegisecurity.util.EncryptionUtils.EncryptionException;
|
||||
|
||||
/**
|
||||
* JUnit tests for EncryptionUtils.
|
||||
*
|
||||
*
|
||||
* @author Alan Stewart
|
||||
* @author Ben Alex
|
||||
* @version $Id$
|
||||
*/
|
||||
public class EncryptionUtilsTests extends TestCase {
|
||||
private final static String STRING_TO_ENCRYPT = "Alan K Stewart";
|
||||
private final static String ENCRYPTION_KEY = "123456789012345678901234567890";
|
||||
private final static String STRING_TO_ENCRYPT = "Alan K Stewart";
|
||||
private final static String ENCRYPTION_KEY = "123456789012345678901234567890";
|
||||
|
||||
public void testEncryptsUsingDESEde() throws EncryptionException {
|
||||
final String encryptedString = EncryptionUtils.encrypt(ENCRYPTION_KEY, STRING_TO_ENCRYPT);
|
||||
assertEquals("3YIE8sIbaEoqGZZrHamFGQ==", encryptedString);
|
||||
}
|
||||
public void testEncryptsUsingDESEde() throws EncryptionException {
|
||||
final String encryptedString = EncryptionUtils.encrypt(ENCRYPTION_KEY, STRING_TO_ENCRYPT);
|
||||
assertEquals("3YIE8sIbaEoqGZZrHamFGQ==", encryptedString);
|
||||
}
|
||||
|
||||
public void testEncryptByteArrayUsingDESEde() {
|
||||
final byte[] encryptedArray = EncryptionUtils.encrypt(ENCRYPTION_KEY, EncryptionUtils.stringToByteArray(STRING_TO_ENCRYPT));
|
||||
assertEquals("3YIE8sIbaEoqGZZrHamFGQ==", EncryptionUtils.byteArrayToString(encryptedArray));
|
||||
}
|
||||
public void testEncryptByteArrayUsingDESEde() {
|
||||
final byte[] encryptedArray = EncryptionUtils.encrypt(ENCRYPTION_KEY, EncryptionUtils.stringToByteArray(STRING_TO_ENCRYPT));
|
||||
assertEquals("3YIE8sIbaEoqGZZrHamFGQ==", EncryptionUtils.byteArrayToString(encryptedArray));
|
||||
}
|
||||
|
||||
public void testEncryptionKeyCanContainLetters() throws EncryptionException {
|
||||
final String encryptedString = EncryptionUtils.encrypt("ASDF asdf 1234 8983 jklasdf J2Jaf8", STRING_TO_ENCRYPT);
|
||||
assertEquals("v4+DQoClx6qm5tJwBcRrkw==", encryptedString);
|
||||
}
|
||||
public void testEncryptionKeyCanContainLetters() throws EncryptionException {
|
||||
final String encryptedString = EncryptionUtils.encrypt("ASDF asdf 1234 8983 jklasdf J2Jaf8", STRING_TO_ENCRYPT);
|
||||
assertEquals("v4+DQoClx6qm5tJwBcRrkw==", encryptedString);
|
||||
}
|
||||
|
||||
public void testDecryptsUsingDESEde() throws EncryptionException {
|
||||
final String encryptedString = "3YIE8sIbaEoqGZZrHamFGQ==";
|
||||
final String decryptedString = EncryptionUtils.decrypt(ENCRYPTION_KEY, encryptedString);
|
||||
assertEquals(STRING_TO_ENCRYPT, decryptedString);
|
||||
}
|
||||
public void testDecryptsUsingDESEde() throws EncryptionException {
|
||||
final String encryptedString = "3YIE8sIbaEoqGZZrHamFGQ==";
|
||||
final String decryptedString = EncryptionUtils.decrypt(ENCRYPTION_KEY, encryptedString);
|
||||
assertEquals(STRING_TO_ENCRYPT, decryptedString);
|
||||
}
|
||||
|
||||
public void testDecryptByteArrayUsingDESEde() {
|
||||
final byte[] encrypted = EncryptionUtils.stringToByteArray("3YIE8sIbaEoqGZZrHamFGQ==");
|
||||
final byte[] decrypted = EncryptionUtils.decrypt(ENCRYPTION_KEY, encrypted);
|
||||
assertEquals(STRING_TO_ENCRYPT, EncryptionUtils.byteArrayToString(decrypted));
|
||||
}
|
||||
public void testDecryptByteArrayUsingDESEde() {
|
||||
final byte[] encrypted = EncryptionUtils.stringToByteArray("3YIE8sIbaEoqGZZrHamFGQ==");
|
||||
final byte[] decrypted = EncryptionUtils.decrypt(ENCRYPTION_KEY, encrypted);
|
||||
assertEquals(STRING_TO_ENCRYPT, EncryptionUtils.byteArrayToString(decrypted));
|
||||
}
|
||||
|
||||
public void testFailEncryptWithNullEncryptionKey() {
|
||||
try {
|
||||
EncryptionUtils.encrypt(null, STRING_TO_ENCRYPT);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
public void testFailEncryptWithNullEncryptionKey() {
|
||||
try {
|
||||
EncryptionUtils.encrypt(null, STRING_TO_ENCRYPT);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testFailEncryptWithEmptyEncryptionKey() {
|
||||
try {
|
||||
EncryptionUtils.encrypt("", STRING_TO_ENCRYPT);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
public void testFailEncryptWithEmptyEncryptionKey() {
|
||||
try {
|
||||
EncryptionUtils.encrypt("", STRING_TO_ENCRYPT);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void teastFailEncryptWithShortEncryptionKey() {
|
||||
try {
|
||||
EncryptionUtils.encrypt("01234567890123456789012", STRING_TO_ENCRYPT);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
public void teastFailEncryptWithShortEncryptionKey() {
|
||||
try {
|
||||
EncryptionUtils.encrypt("01234567890123456789012", STRING_TO_ENCRYPT);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testFailDecryptWithEmptyString() {
|
||||
try {
|
||||
EncryptionUtils.decrypt(ENCRYPTION_KEY, "");
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
public void testFailDecryptWithEmptyString() {
|
||||
try {
|
||||
EncryptionUtils.decrypt(ENCRYPTION_KEY, "");
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testFailEncryptWithEmptyString() {
|
||||
try {
|
||||
EncryptionUtils.encrypt(ENCRYPTION_KEY, "");
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
public void testFailEncryptWithEmptyString() {
|
||||
try {
|
||||
EncryptionUtils.encrypt(ENCRYPTION_KEY, "");
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testFailEncryptWithNullString() {
|
||||
try {
|
||||
EncryptionUtils.encrypt(ENCRYPTION_KEY, (String) null);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
public void testFailEncryptWithNullString() {
|
||||
try {
|
||||
EncryptionUtils.encrypt(ENCRYPTION_KEY, (String) null);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testEncryptAndDecrypt() throws EncryptionException {
|
||||
final String stringToEncrypt = "Alan Stewart";
|
||||
final String encryptedString = EncryptionUtils.encrypt(ENCRYPTION_KEY, stringToEncrypt);
|
||||
final String decryptedString = EncryptionUtils.decrypt(ENCRYPTION_KEY, encryptedString);
|
||||
assertEquals(stringToEncrypt, decryptedString);
|
||||
}
|
||||
public void testEncryptAndDecrypt() throws EncryptionException {
|
||||
final String stringToEncrypt = "Alan Stewart";
|
||||
final String encryptedString = EncryptionUtils.encrypt(ENCRYPTION_KEY, stringToEncrypt);
|
||||
final String decryptedString = EncryptionUtils.decrypt(ENCRYPTION_KEY, encryptedString);
|
||||
assertEquals(stringToEncrypt, decryptedString);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user