Move old jdk download tests to openjdk tests (#55361)
The "old jdk" tests are just testing support for downloading from oracle prior to java 12.0.1, when oracle added a hash to the url. This commit moves these tests into the openjdk tests (ie oracle download tests), since adoptopenjdk does not have any change in behavior that needs to be tested.
This commit is contained in:
parent
9fb30942e0
commit
bed422162c
|
@ -24,11 +24,6 @@ import java.io.InputStream;
|
|||
|
||||
public class AdoptOpenJdkDownloadPluginIT extends JdkDownloadPluginIT {
|
||||
|
||||
@Override
|
||||
public String oldJdkVersion() {
|
||||
return "1+99";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String jdkVersion() {
|
||||
return "12.0.2+10";
|
||||
|
@ -40,13 +35,9 @@ public class AdoptOpenJdkDownloadPluginIT extends JdkDownloadPluginIT {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String urlPath(final boolean isOld, final String platform, final String extension) {
|
||||
protected String urlPath(final String version, final String platform, final String extension) {
|
||||
final String module = platform.equals("osx") ? "mac" : platform;
|
||||
if (isOld) {
|
||||
return "/adoptopenjdk/OpenJDK1U-jdk_x64_" + module + "_hotspot_1_99." + extension;
|
||||
} else {
|
||||
return "/adoptopenjdk/OpenJDK12U-jdk_x64_" + module + "_hotspot_12.0.2_10." + extension;
|
||||
}
|
||||
return "/adoptopenjdk/OpenJDK12U-jdk_x64_" + module + "_hotspot_12.0.2_10." + extension;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,8 +43,6 @@ public abstract class JdkDownloadPluginIT extends GradleIntegrationTestCase {
|
|||
private static final Pattern JDK_HOME_LOGLINE = Pattern.compile("JDK HOME: (.*)");
|
||||
private static final Pattern NUM_CONFIGS_LOGLINE = Pattern.compile("NUM CONFIGS: (.*)");
|
||||
|
||||
protected abstract String oldJdkVersion();
|
||||
|
||||
protected abstract String jdkVersion();
|
||||
|
||||
protected abstract String jdkVendor();
|
||||
|
@ -61,18 +59,6 @@ public abstract class JdkDownloadPluginIT extends GradleIntegrationTestCase {
|
|||
assertExtraction("getWindowsJdk", "windows", "bin/java", jdkVendor(), jdkVersion());
|
||||
}
|
||||
|
||||
public final void testLinuxExtractionOldVersion() throws IOException {
|
||||
assertExtraction("getLinuxJdk", "linux", "bin/java", jdkVendor(), oldJdkVersion());
|
||||
}
|
||||
|
||||
public final void testDarwinExtractionOldVersion() throws IOException {
|
||||
assertExtraction("getDarwinJdk", "osx", "Contents/Home/bin/java", jdkVendor(), oldJdkVersion());
|
||||
}
|
||||
|
||||
public final void testWindowsExtractionOldVersion() throws IOException {
|
||||
assertExtraction("getWindowsJdk", "windows", "bin/java", jdkVendor(), oldJdkVersion());
|
||||
}
|
||||
|
||||
public final void testCrossProjectReuse() throws IOException {
|
||||
runBuild("numConfigurations", "linux", result -> {
|
||||
Matcher matcher = NUM_CONFIGS_LOGLINE.matcher(result.getOutput());
|
||||
|
@ -81,7 +67,7 @@ public abstract class JdkDownloadPluginIT extends GradleIntegrationTestCase {
|
|||
}, jdkVendor(), jdkVersion());
|
||||
}
|
||||
|
||||
private void assertExtraction(String taskname, String platform, String javaBin, String vendor, String version) throws IOException {
|
||||
protected void assertExtraction(String taskname, String platform, String javaBin, String vendor, String version) throws IOException {
|
||||
runBuild(taskname, platform, result -> {
|
||||
Matcher matcher = JDK_HOME_LOGLINE.matcher(result.getOutput());
|
||||
assertTrue("could not find jdk home in output: " + result.getOutput(), matcher.find());
|
||||
|
@ -91,7 +77,7 @@ public abstract class JdkDownloadPluginIT extends GradleIntegrationTestCase {
|
|||
}, vendor, version);
|
||||
}
|
||||
|
||||
protected abstract String urlPath(boolean isOld, String platform, String extension);
|
||||
protected abstract String urlPath(String version, String platform, String extension);
|
||||
|
||||
protected abstract byte[] filebytes(String platform, String extension) throws IOException;
|
||||
|
||||
|
@ -100,11 +86,10 @@ public abstract class JdkDownloadPluginIT extends GradleIntegrationTestCase {
|
|||
WireMockServer wireMock = new WireMockServer(0);
|
||||
try {
|
||||
String extension = platform.equals("windows") ? "zip" : "tar.gz";
|
||||
boolean isOld = version.equals(oldJdkVersion());
|
||||
|
||||
wireMock.stubFor(head(urlEqualTo(urlPath(isOld, platform, extension))).willReturn(aResponse().withStatus(200)));
|
||||
wireMock.stubFor(head(urlEqualTo(urlPath(version, platform, extension))).willReturn(aResponse().withStatus(200)));
|
||||
wireMock.stubFor(
|
||||
get(urlEqualTo(urlPath(isOld, platform, extension))).willReturn(
|
||||
get(urlEqualTo(urlPath(version, platform, extension))).willReturn(
|
||||
aResponse().withStatus(200).withBody(filebytes(platform, extension))
|
||||
)
|
||||
);
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.InputStream;
|
|||
|
||||
public class OpenJdkDownloadPluginIT extends JdkDownloadPluginIT {
|
||||
|
||||
@Override
|
||||
public String oldJdkVersion() {
|
||||
return "1+99";
|
||||
}
|
||||
|
@ -40,7 +39,8 @@ public class OpenJdkDownloadPluginIT extends JdkDownloadPluginIT {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String urlPath(final boolean isOld, final String platform, final String extension) {
|
||||
protected String urlPath(final String version, final String platform, final String extension) {
|
||||
final boolean isOld = version.equals(oldJdkVersion());
|
||||
final String versionPath = isOld ? "jdk1/99" : "jdk12.0.1/123456789123456789123456789abcde/99";
|
||||
final String filename = "openjdk-" + (isOld ? "1" : "12.0.1") + "_" + platform + "-x64_bin." + extension;
|
||||
return "/java/GA/" + versionPath + "/GPL/" + filename;
|
||||
|
@ -53,4 +53,16 @@ public class OpenJdkDownloadPluginIT extends JdkDownloadPluginIT {
|
|||
}
|
||||
}
|
||||
|
||||
public final void testLinuxExtractionOldVersion() throws IOException {
|
||||
assertExtraction("getLinuxJdk", "linux", "bin/java", jdkVendor(), oldJdkVersion());
|
||||
}
|
||||
|
||||
public final void testDarwinExtractionOldVersion() throws IOException {
|
||||
assertExtraction("getDarwinJdk", "osx", "Contents/Home/bin/java", jdkVendor(), oldJdkVersion());
|
||||
}
|
||||
|
||||
public final void testWindowsExtractionOldVersion() throws IOException {
|
||||
assertExtraction("getWindowsJdk", "windows", "bin/java", jdkVendor(), oldJdkVersion());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue