Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
878d717b92
|
@ -282,7 +282,7 @@ public abstract class AbstractDoSFilterTest
|
|||
assertEquals(0,count(responses,"DoSFilter: delayed"));
|
||||
|
||||
// alternate between sessions
|
||||
responses = doRequests(request1+request2+request1+request2+request1,2,550,550,last);
|
||||
responses = doRequests(request1+request2+request1+request2+request1,2,350,550,last);
|
||||
|
||||
assertEquals(11,count(responses,"HTTP/1.1 200 OK"));
|
||||
int delayedRequests = count(responses,"DoSFilter: delayed");
|
||||
|
|
|
@ -669,14 +669,14 @@ public class Main
|
|||
{
|
||||
cmd.addArg(x);
|
||||
}
|
||||
cmd.addEqualsArg("-Djetty.home",_jettyHome);
|
||||
cmd.addRawArg("-Djetty.home=" + _jettyHome);
|
||||
for (String p : _sysProps)
|
||||
{
|
||||
String v = System.getProperty(p);
|
||||
cmd.addEqualsArg("-D" + p,v);
|
||||
}
|
||||
cmd.addArg("-cp");
|
||||
cmd.addArg(classpath.toString());
|
||||
cmd.addRawArg(classpath.toString());
|
||||
cmd.addRawArg(_config.getMainClassname());
|
||||
|
||||
// Check if we need to pass properties as a file
|
||||
|
@ -692,9 +692,8 @@ public class Main
|
|||
|
||||
for (String xml : xmls)
|
||||
{
|
||||
cmd.addArg(xml);
|
||||
cmd.addRawArg(xml);
|
||||
}
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,13 +13,16 @@
|
|||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.junit.Assert;
|
||||
|
@ -76,7 +79,7 @@ public class MainTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuildCommandLine() throws IOException
|
||||
public void testBuildCommandLine() throws IOException, NoSuchFieldException, IllegalAccessException
|
||||
{
|
||||
List<String> jvmArgs = new ArrayList<String>();
|
||||
jvmArgs.add("--exec");
|
||||
|
@ -91,13 +94,30 @@ public class MainTest
|
|||
Main main = new Main();
|
||||
main.addJvmArgs(jvmArgs);
|
||||
|
||||
CommandLineBuilder cmd = main.buildCommandLine(new Classpath(""),xmls);
|
||||
Assert.assertThat("CommandLineBuilder shouldn't be null", cmd, notNullValue());
|
||||
Classpath classpath = nastyWayToCreateAClasspathObject("/jetty/home with spaces/");
|
||||
CommandLineBuilder cmd = main.buildCommandLine(classpath,xmls);
|
||||
Assert.assertThat("CommandLineBuilder shouldn't be null",cmd,notNullValue());
|
||||
String commandLine = cmd.toString();
|
||||
Assert.assertThat("CommandLine shouldn't be null", commandLine, notNullValue());
|
||||
Assert.assertThat("CommandLine should contain jvmArgs",commandLine, containsString("--exec -Xms1024m -Xmx1024m"));
|
||||
Assert.assertThat("CommandLine should contain xmls",commandLine, containsString("jetty.xml jetty-jmx.xml jetty-logging.xml"));
|
||||
Assert.assertThat("CommandLine shouldn't be null",commandLine,notNullValue());
|
||||
Assert.assertThat("Classpath should be correctly quoted and match expected value",commandLine,
|
||||
containsString("-cp /jetty/home with spaces/somejar.jar:/jetty/home with spaces/someotherjar.jar"));
|
||||
Assert.assertThat("CommandLine should contain jvmArgs",commandLine,containsString("--exec -Xms1024m -Xmx1024m"));
|
||||
Assert.assertThat("CommandLine should contain xmls",commandLine,containsString("jetty.xml jetty-jmx.xml jetty-logging.xml"));
|
||||
|
||||
}
|
||||
|
||||
private Classpath nastyWayToCreateAClasspathObject(String jettyHome) throws NoSuchFieldException, IllegalAccessException
|
||||
{
|
||||
Classpath classpath = new Classpath();
|
||||
Field classpathElements = Classpath.class.getDeclaredField("_elements");
|
||||
classpathElements.setAccessible(true);
|
||||
File file = new File(jettyHome + "somejar.jar");
|
||||
File file2 = new File(jettyHome + "someotherjar.jar");
|
||||
Vector<File> elements = new Vector<File>();
|
||||
elements.add(file);
|
||||
elements.add(file2);
|
||||
classpathElements.set(classpath,elements);
|
||||
return classpath;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue