Add test to check version information.

This commit is contained in:
Luke Taylor 2011-05-07 17:15:02 +01:00
parent 6a2a636fd7
commit 396eced291
2 changed files with 14 additions and 6 deletions

View File

@ -26,6 +26,9 @@ dependencies {
int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES') int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES')
test { test {
systemProperties['springSecurityVersion'] = version
systemProperties['springVersion'] = springVersion
if (maxAESKeySize < 256) { if (maxAESKeySize < 256) {
logger.warn("AES keysize limited to $maxAESKeySize, skipping EncryptorsTests") logger.warn("AES keysize limited to $maxAESKeySize, skipping EncryptorsTests")
exclude '**/EncryptorsTests.class' exclude '**/EncryptorsTests.class'

View File

@ -20,6 +20,10 @@ public class SpringSecurityCoreVersion {
*/ */
public static final long SERIAL_VERSION_UID = 310L; public static final long SERIAL_VERSION_UID = 310L;
static final String SPRING_MAJOR_VERSION = "3";
static final String MIN_SPRING_VERSION = "3.0.5.RELEASE";
static { static {
// Check Spring Compatibility // Check Spring Compatibility
String springVersion = SpringVersion.getVersion(); String springVersion = SpringVersion.getVersion();
@ -27,14 +31,15 @@ public class SpringSecurityCoreVersion {
if (springVersion != null) { if (springVersion != null) {
logger.info("You are running with Spring Security Core " + version); logger.info("You are running with Spring Security Core " + version);
if (!springVersion.startsWith("3")) { if (!springVersion.startsWith(SPRING_MAJOR_VERSION)) {
logger.error("Spring Major version '3' expected, but you are running with version: " logger.error("*** Spring Major version '" + SPRING_MAJOR_VERSION +
+ springVersion + ". Please check your classpath for unwanted jar files."); "' expected, but you are running with version: " + springVersion +
". Please check your classpath for unwanted jar files.");
} }
if (springVersion.compareTo("3.0.5") < 0) { if (springVersion.compareTo(MIN_SPRING_VERSION) < 0) {
logger.warn("You are advised to use Spring 3.0.5 or later with this version. You are running: " + logger.warn("**** You are advised to use Spring " + MIN_SPRING_VERSION +
springVersion); " or later with this version. You are running: " + springVersion);
} }
} }
} }