提交 b7c25bdf 编写于 作者: J jglick

[FIXED HUDSON-3989] Installation of JDK 1.4.x did not work due to to "j2sdk" dir name.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19476 71c3de6d-444a-0410-be80-ed276b4c234a
上级 3fda643f
......@@ -215,9 +215,9 @@ public class JDKInstaller extends ToolInstaller {
private static class JdkFinder implements FileFilter, Serializable {
private static final long serialVersionUID = 1L;
public boolean accept(File f) {
return f.isDirectory() && f.getName().startsWith("jdk");
return f.isDirectory() && f.getName().matches("j(2s)?dk.*");
}
};
}
/**
* Performs a license click through and obtains the one-time URL for downloading bits.
......@@ -229,6 +229,7 @@ public class JDKInstaller extends ToolInstaller {
return locateStage2(log, page);
}
@SuppressWarnings("unchecked") // dom4j doesn't do generics, apparently... should probably switch to XOM
private HttpURLConnection locateStage1(Platform platform, CPU cpu) throws IOException {
URL url = new URL("https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef="+id);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
......
......@@ -8,6 +8,7 @@ import hudson.tasks.Shell;
import java.io.File;
import java.util.Arrays;
import org.jvnet.hudson.test.Bug;
/**
* @author Kohsuke Kawaguchi
......@@ -34,13 +35,21 @@ public class JDKInstallerTest extends HudsonTestCase {
/**
* Tests the auto installation.
*/
public void testAutoInstallation() throws Exception {
public void testAutoInstallation6u13() throws Exception {
doTestAutoInstallation("jdk-6u13-oth-JPR@CDS-CDS_Developer", "1.6.0_13-b03");
}
@Bug(3989)
public void testAutoInstallation142_17() throws Exception {
doTestAutoInstallation("j2sdk-1.4.2_17-oth-JPR@CDS-CDS_Developer", "1.4.2_17-b06");
}
private void doTestAutoInstallation(String id, String fullversion) throws Exception {
// this is a really time consuming test, so only run it when we really want
if(!Boolean.getBoolean("hudson.sunTests"))
return;
File tmp = env.temporaryDirectoryAllocator.allocate();
JDKInstaller installer = new JDKInstaller("jdk-6u13-oth-JPR@CDS-CDS_Developer", true);
JDKInstaller installer = new JDKInstaller(id, true);
JDK jdk = new JDK("test", tmp.getAbsolutePath(), Arrays.asList(
new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer))));
......@@ -51,9 +60,11 @@ public class JDKInstallerTest extends HudsonTestCase {
p.setJDK(jdk);
p.getBuildersList().add(new Shell("java -fullversion\necho $JAVA_HOME"));
FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0).get());
System.out.println(b.getLog());
@SuppressWarnings("deprecation") String log = b.getLog();
System.out.println(log);
// make sure it runs with the JDK that just got installed
assertTrue(b.getLog().contains("1.6.0_13-b03"));
assertTrue(b.getLog().contains(tmp.getAbsolutePath()));
assertTrue(log.contains(fullversion));
assertTrue(log.contains(tmp.getAbsolutePath()));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册