提交 4edbb06b 编写于 作者: K kohsuke

[FIXED HUDSON-3398] Allow JVM arguments to be specified for JNLP slaves.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16860 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9429fff8
......@@ -49,13 +49,20 @@ public class JNLPLauncher extends ComputerLauncher {
*/
public final String tunnel;
/**
* Additional JVM arguments. Can be null.
* @since 1.297
*/
public final String vmargs;
@DataBoundConstructor
public JNLPLauncher(String tunnel) {
public JNLPLauncher(String tunnel, String vmargs) {
this.tunnel = Util.fixEmptyAndTrim(tunnel);
this.vmargs = Util.fixEmptyAndTrim(vmargs);
}
public JNLPLauncher() {
this(null);
this(null,null);
}
@Override
......
......@@ -27,5 +27,8 @@ THE SOFTWARE.
<f:entry title="${%Tunnel connection through}" help="/help/system-config/master-slave/jnlp-tunnel.html">
<f:textbox field="tunnel"/>
</f:entry>
<f:entry title="${%JVM options}" field="vmargs">
<f:textbox />
</f:entry>
</f:advanced>
</j:jelly>
\ No newline at end of file
<div>
If the slave JVM should be launched with additional VM arguments, such as "-Xmx256m",
specify those here. List of all the options are available
<a href="http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp" target="_new">here</a>.
</div>
\ No newline at end of file
......@@ -49,10 +49,10 @@ THE SOFTWARE.
<j:set var="port" value="${request.getParameter('debugPort')}"/>
<j:choose>
<j:when test="${port!=null}">
<j2se version="1.5+" java-vm-args="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=${port}" />
<j2se version="1.5+" java-vm-args="${it.launcher.vmargs} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=${port}" />
</j:when>
<j:otherwise>
<j2se version="1.5+" />
<j2se version="1.5+" java-vm-args="${it.launcher.vmargs}"/>
</j:otherwise>
</j:choose>
<jar href="${rootURL}jnlpJars/remoting.jar"/>
......
......@@ -74,6 +74,7 @@ import java.io.PrintWriter;
import java.lang.annotation.Annotation;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
......@@ -579,9 +580,22 @@ public abstract class HudsonTestCase extends TestCase {
public void assertEqualBeans(Object lhs, Object rhs, String properties) throws Exception {
for (String p : properties.split(",")) {
PropertyDescriptor pd = PropertyUtils.getPropertyDescriptor(lhs, p);
assertNotNull("No such property "+p+" on "+lhs.getClass(),pd);
Object lp = PropertyUtils.getProperty(lhs, p);
Object rp = PropertyUtils.getProperty(rhs, p);
Object lp,rp;
if(pd==null) {
// field?
try {
Field f1 = lhs.getClass().getField(p);
Field f2 = rhs.getClass().getField(p);
lp = f1.get(lhs);
rp = f2.get(rhs);
} catch (NoSuchFieldException e) {
assertNotNull("No such property "+p+" on "+lhs.getClass(),pd);
return;
}
} else {
lp = PropertyUtils.getProperty(lhs, p);
rp = PropertyUtils.getProperty(rhs, p);
}
assertEquals("Property "+p+" is different",lp,rp);
}
}
......
......@@ -141,4 +141,13 @@ public class JNLPLauncherTest extends HudsonTestCase {
private static final long serialVersionUID = 1L;
}
public void testConfigRoundtrip() throws Exception {
DumbSlave s = createSlave();
JNLPLauncher original = new JNLPLauncher("a", "b");
s.setLauncher(original);
HtmlPage p = new WebClient().getPage(s, "configure");
submit(p.getFormByName("config"));
assertEqualBeans(original,s.getLauncher(),"tunnel,vmargs");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册