Add test to check version information.
This commit is contained in:
parent
6a2a636fd7
commit
396eced291
|
@ -26,6 +26,9 @@ dependencies {
|
|||
int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES')
|
||||
|
||||
test {
|
||||
systemProperties['springSecurityVersion'] = version
|
||||
systemProperties['springVersion'] = springVersion
|
||||
|
||||
if (maxAESKeySize < 256) {
|
||||
logger.warn("AES keysize limited to $maxAESKeySize, skipping EncryptorsTests")
|
||||
exclude '**/EncryptorsTests.class'
|
||||
|
|
|
@ -20,6 +20,10 @@ public class SpringSecurityCoreVersion {
|
|||
*/
|
||||
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 {
|
||||
// Check Spring Compatibility
|
||||
String springVersion = SpringVersion.getVersion();
|
||||
|
@ -27,14 +31,15 @@ public class SpringSecurityCoreVersion {
|
|||
|
||||
if (springVersion != null) {
|
||||
logger.info("You are running with Spring Security Core " + version);
|
||||
if (!springVersion.startsWith("3")) {
|
||||
logger.error("Spring Major version '3' expected, but you are running with version: "
|
||||
+ springVersion + ". Please check your classpath for unwanted jar files.");
|
||||
if (!springVersion.startsWith(SPRING_MAJOR_VERSION)) {
|
||||
logger.error("*** Spring Major version '" + SPRING_MAJOR_VERSION +
|
||||
"' expected, but you are running with version: " + springVersion +
|
||||
". Please check your classpath for unwanted jar files.");
|
||||
}
|
||||
|
||||
if (springVersion.compareTo("3.0.5") < 0) {
|
||||
logger.warn("You are advised to use Spring 3.0.5 or later with this version. You are running: " +
|
||||
springVersion);
|
||||
if (springVersion.compareTo(MIN_SPRING_VERSION) < 0) {
|
||||
logger.warn("**** You are advised to use Spring " + MIN_SPRING_VERSION +
|
||||
" or later with this version. You are running: " + springVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue