diff --git a/core/src/main/java/hudson/slaves/JNLPLauncher.java b/core/src/main/java/hudson/slaves/JNLPLauncher.java index 5926971d0d..b2b5ec8b09 100644 --- a/core/src/main/java/hudson/slaves/JNLPLauncher.java +++ b/core/src/main/java/hudson/slaves/JNLPLauncher.java @@ -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 diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly b/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly index e834fc6007..511de81344 100644 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly +++ b/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly @@ -27,5 +27,8 @@ THE SOFTWARE. + + + \ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs.html b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs.html new file mode 100644 index 0000000000..a790e8cb3c --- /dev/null +++ b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs.html @@ -0,0 +1,5 @@ +
+ If the slave JVM should be launched with additional VM arguments, such as "-Xmx256m", + specify those here. List of all the options are available + here. +
\ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly b/core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly index e3ae0b3fe1..c62f7c3c43 100644 --- a/core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly +++ b/core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly @@ -49,10 +49,10 @@ THE SOFTWARE. - + - + diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index 5cc2f6e7b2..493d7a174e 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -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); } } diff --git a/test/src/test/java/hudson/slaves/JNLPLauncherTest.java b/test/src/test/java/hudson/slaves/JNLPLauncherTest.java index 8b430af229..9f9dcd5bad 100644 --- a/test/src/test/java/hudson/slaves/JNLPLauncherTest.java +++ b/test/src/test/java/hudson/slaves/JNLPLauncherTest.java @@ -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"); + } }