Skip to content
Permalink
Browse files

[JENKINS-44851] Agents JVM must be 1.8+ now (#2915)

* [JENKINS-44851] Agents JVM must be 1.8+ now

* [JENKINS-44851] Fix tests

* Fix old Java 6 and 7 tests (an exception is expected now)
* Add new tests to Java 8
* Fix messages
  • Loading branch information...
amuniz authored and oleg-nenashev committed Oct 28, 2017
1 parent 6e75f73 commit f546ffc9ea09626e2e15bd4d9564ee32da18335d
@@ -187,7 +187,7 @@ protected static void checkJavaVersion(final PrintStream logger, String javaComm
final String versionStr = m.group(1);
logger.println(Messages.ComputerLauncher_JavaVersionResult(javaCommand, versionStr));
try {
if (new DeweyDecimal(versionStr).isLessThan(new DeweyDecimal("1.6"))) {
if (new DeweyDecimal(versionStr).isLessThan(new DeweyDecimal("1.8"))) {
throw new IOException(Messages
.ComputerLauncher_NoJavaFound(line));
}
@@ -36,7 +36,7 @@ SimpleScheduledRetentionStrategy.displayName=Take this agent online according to
EnvironmentVariablesNodeProperty.displayName=Environment variables
SlaveComputer.DisconnectedBy=Disconnected by {0}{1}
NodeDescriptor.CheckName.Mandatory=Name is mandatory
ComputerLauncher.NoJavaFound=Java version {0} was found but 1.6 or later is needed.
ComputerLauncher.NoJavaFound=Java version {0} was found but 1.8 or later is needed.
ComputerLauncher.JavaVersionResult={0} -version returned {1}.
ComputerLauncher.UnknownJavaVersion=Couldn\u2019t figure out the Java version of {0}
Cloud.ProvisionPermission.Description=Provision new nodes
@@ -36,15 +36,15 @@

public class ComputerLauncherTest {

@Test public void jdk7() throws IOException {
@Test(expected=IOException.class) public void jdk7() throws IOException {
assertChecked("java version \"1.7.0_05\"\nJava(TM) SE Runtime Environment (build 1.7.0_05-b05)\nJava HotSpot(TM) Server VM (build 23.1-b03, mixed mode)\n", "1.7.0");
}

@Test public void openJDK7() throws IOException {
@Test(expected=IOException.class) public void openJDK7() throws IOException {
assertChecked("openjdk version \"1.7.0-internal\"\nOpenJDK Runtime Environment (build 1.7.0-internal-pkgsrc_2010_01_03_06_54-b00)\nOpenJDK 64-Bit Server VM (build 17.0-b04, mixed mode)\n", "1.7.0");
}

@Test public void jdk6() throws IOException {
@Test(expected=IOException.class) public void jdk6() throws IOException {
assertChecked("java version \"1.6.0_33\"\nJava(TM) SE Runtime Environment (build 1.6.0_33-b03)\nJava HotSpot(TM) Server VM (build 20.8-b03, mixed mode)\n", "1.6.0");
}

@@ -56,6 +56,14 @@
ComputerLauncher.checkJavaVersion(new PrintStream(new NullOutputStream()), "-", new BufferedReader(new StringReader("java version \"1.4.2_19\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)\nJava HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)\n")));
}

@Test public void jdk8() throws IOException {
assertChecked("java version \"1.8.0_05\"\nJava(TM) SE Runtime Environment (build 1.8.0_05-b05)\nJava HotSpot(TM) Server VM (build 23.1-b03, mixed mode)\n", "1.8.0");
}

@Test public void openJDK8() throws IOException {
assertChecked("openjdk version \"1.8.0-internal\"\nOpenJDK Runtime Environment (build 1.8.0-internal-pkgsrc_2015_01_03_06_54-b00)\nOpenJDK 64-Bit Server VM (build 17.0-b04, mixed mode)\n", "1.8.0");
}

@Test public void jdk10() throws IOException { // predicted
assertChecked("java version \"1.10.0_02\"\nJava(TM) SE Runtime Environment (build 1.10.0_02-b01)\nJava HotSpot(TM) Server VM (build 23.1-b03, mixed mode)\n", "1.10.0");
}

0 comments on commit f546ffc

Please sign in to comment.
You can’t perform that action at this time.