VIVO-581 Add a smoke test for Java version

This commit is contained in:
j2blake 2013-12-10 12:07:28 -05:00
parent 03750cd669
commit 0a00aee684

View file

@ -22,9 +22,26 @@ public class JvmSmokeTests implements ServletContextListener {
ServletContext ctx = sce.getServletContext(); ServletContext ctx = sce.getServletContext();
StartupStatus ss = StartupStatus.getBean(ctx); StartupStatus ss = StartupStatus.getBean(ctx);
checkJvmLevel(ss);
checkTempDirectory(ss); checkTempDirectory(ss);
} }
/**
* We need to run at 1.7 or later.
*/
private void checkJvmLevel(StartupStatus ss) {
String specLevel = System.getProperty("java.specification.version", "");
if (specLevel.isEmpty()) {
ss.warning(this, "Can't determine the current level of Java. "
+ "VIVO requires at least Java 1.7.");
} else if (specLevel.compareTo("1.7") < 0) {
ss.warning(this, "VIVO requires at least Java 1.7 - "
+ "currently running on Java " + specLevel);
} else {
ss.info(this, "Java version is " + specLevel);
}
}
/** /**
* Check the Java temp directory. Make sure that it exists, it is a * Check the Java temp directory. Make sure that it exists, it is a
* directory, we can read it, we can write to it. * directory, we can read it, we can write to it.