Making tests more reliable on lesser FileSystems
This commit is contained in:
parent
20ba801f32
commit
bb9a05d9fe
|
@ -19,6 +19,7 @@
|
||||||
package org.eclipse.jetty.servlet;
|
package org.eclipse.jetty.servlet;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assume.assumeTrue;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -231,10 +232,7 @@ public class DefaultServletTest
|
||||||
createFile(index, "<h1>Hello Index</h1>");
|
createFile(index, "<h1>Hello Index</h1>");
|
||||||
|
|
||||||
File wackyDir = new File(resBase, "dir?");
|
File wackyDir = new File(resBase, "dir?");
|
||||||
if (!OS.IS_WINDOWS)
|
assumeTrue("FileSystem should support question dirs", wackyDir.mkdirs());
|
||||||
{
|
|
||||||
FS.ensureDirExists(wackyDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
wackyDir = new File(resBase, "dir;");
|
wackyDir = new File(resBase, "dir;");
|
||||||
assertTrue(wackyDir.mkdirs());
|
assertTrue(wackyDir.mkdirs());
|
||||||
|
@ -266,13 +264,8 @@ public class DefaultServletTest
|
||||||
response = connector.getResponse("GET /context/dir?/ HTTP/1.0\r\n\r\n");
|
response = connector.getResponse("GET /context/dir?/ HTTP/1.0\r\n\r\n");
|
||||||
assertResponseContains("404", response);
|
assertResponseContains("404", response);
|
||||||
|
|
||||||
if (!OS.IS_WINDOWS)
|
response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n");
|
||||||
{
|
assertResponseContains("Directory: /context/dir?/<", response);
|
||||||
response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n");
|
|
||||||
assertResponseContains("Directory: /context/dir?/<", response);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
assertResponseContains("404", response);
|
|
||||||
|
|
||||||
response = connector.getResponse("GET /context/index.html HTTP/1.0\r\n\r\n");
|
response = connector.getResponse("GET /context/index.html HTTP/1.0\r\n\r\n");
|
||||||
assertResponseContains("Hello Index", response);
|
assertResponseContains("Hello Index", response);
|
||||||
|
@ -421,7 +414,8 @@ public class DefaultServletTest
|
||||||
context.setBaseResource(Resource.newResource(resBase));
|
context.setBaseResource(Resource.newResource(resBase));
|
||||||
|
|
||||||
File dir = new File(resBase, "dir?");
|
File dir = new File(resBase, "dir?");
|
||||||
assertTrue(dir.mkdirs());
|
assumeTrue("FileSystem should support question dirs", dir.mkdirs());
|
||||||
|
|
||||||
File index = new File(dir, "index.html");
|
File index = new File(dir, "index.html");
|
||||||
createFile(index, "<h1>Hello Index</h1>");
|
createFile(index, "<h1>Hello Index</h1>");
|
||||||
|
|
||||||
|
@ -438,7 +432,6 @@ public class DefaultServletTest
|
||||||
assertResponseContains("Location: http://0.0.0.0/context/dir%3F/index.html", response);
|
assertResponseContains("Location: http://0.0.0.0/context/dir%3F/index.html", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWelcomeServlet() throws Exception
|
public void testWelcomeServlet() throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue