summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorThomas Becker2012-01-30 08:37:33 (EST)
committer Joakim Erdfelt2012-01-30 11:17:59 (EST)
commit9f667257f1ee38b05f683bbadc97aed68dda6e79 (patch)
treea1b37660964fe5f86a169f2d1c5197b57a336080
parent40963a884e32766b878056b83a97fe5130828051 (diff)
downloadorg.eclipse.jetty.project-9f667257f1ee38b05f683bbadc97aed68dda6e79.zip
org.eclipse.jetty.project-9f667257f1ee38b05f683bbadc97aed68dda6e79.tar.gz
org.eclipse.jetty.project-9f667257f1ee38b05f683bbadc97aed68dda6e79.tar.bz2
370120: --exec jvm arguments missing spaces fix
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Main.java7
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java33
2 files changed, 35 insertions, 5 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
index 69112f8..f734d64 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
@@ -659,7 +659,7 @@ public class Main
throw new FileNotFoundException("Unable to find XML Config: " + xmlFilename);
}
- private String buildCommandLine(Classpath classpath, List<String> xmls) throws IOException
+ String buildCommandLine(Classpath classpath, List<String> xmls) throws IOException
{
StringBuilder cmd = new StringBuilder();
cmd.append(findJavaBin());
@@ -1090,4 +1090,9 @@ public class Main
return args;
}
+
+ void addJvmArgs(List<String> jvmArgs)
+ {
+ _jvmArgs.addAll(jvmArgs);
+ }
}
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
index 63143c7..9ebcaf4 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
@@ -13,10 +13,12 @@
package org.eclipse.jetty.start;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
@@ -53,18 +55,18 @@ public class MainTest
public void testExpandCommandLine() throws Exception
{
Main main = new Main();
- List<String> args = main.expandCommandLine(new String[]{});
+ List<String> args = main.expandCommandLine(new String[] {});
assertEquals("start.ini OPTIONS","OPTIONS=Server,jsp,resources,websocket,ext",args.get(0));
assertEquals("start.d/jmx OPTIONS","OPTIONS=jmx",args.get(5));
assertEquals("start.d/jmx XML","--pre=etc/jetty-jmx.xml",args.get(6));
assertEquals("start.d/websocket OPTIONS","OPTIONS=websocket",args.get(7));
}
-
+
@Test
public void testProcessCommandLine() throws Exception
{
Main main = new Main();
- List<String> args = main.expandCommandLine(new String[]{});
+ List<String> args = main.expandCommandLine(new String[] {});
List<String> xmls = main.processCommandLine(args);
assertEquals("jmx --pre","etc/jetty-jmx.xml",xmls.get(0));
@@ -72,4 +74,27 @@ public class MainTest
assertEquals("start.d","etc/jetty-testrealm.xml",xmls.get(5));
}
+ @Test
+ public void testBuildCommandLine() throws IOException
+ {
+ List<String> jvmArgs = new ArrayList<String>();
+ jvmArgs.add("--exec");
+ jvmArgs.add("-Xms1024m");
+ jvmArgs.add("-Xmx1024m");
+
+ List<String> xmls = new ArrayList<String>();
+ xmls.add("jetty.xml");
+ xmls.add("jetty-jmx.xml");
+ xmls.add("jetty-logging.xml");
+
+ Main main = new Main();
+ main.addJvmArgs(jvmArgs);
+
+ String commandLine = main.buildCommandLine(new Classpath(""),xmls);
+ assertTrue("CommandLine shouldn't be null",commandLine != null);
+ assertTrue("CommandLine should contain jvmArgs",commandLine.contains("--exec -Xms1024m -Xmx1024m"));
+ assertTrue("CommandLine should contain xmls",commandLine.contains("jetty.xml jetty-jmx.xml jetty-logging.xml"));
+
+ }
+
}