From bb9a05d9feb9d9574a9ab59bb6fa3e7c95294c10 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 29 Jun 2017 09:57:28 -0700 Subject: [PATCH] Making tests more reliable on lesser FileSystems --- .../jetty/servlet/DefaultServletTest.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java index cff16eeea75..833d9236298 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.servlet; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; import java.io.File; import java.io.FileOutputStream; @@ -231,10 +232,7 @@ public class DefaultServletTest createFile(index, "

Hello Index

"); File wackyDir = new File(resBase, "dir?"); - if (!OS.IS_WINDOWS) - { - FS.ensureDirExists(wackyDir); - } + assumeTrue("FileSystem should support question dirs", wackyDir.mkdirs()); wackyDir = new File(resBase, "dir;"); assertTrue(wackyDir.mkdirs()); @@ -266,13 +264,8 @@ public class DefaultServletTest response = connector.getResponse("GET /context/dir?/ HTTP/1.0\r\n\r\n"); 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); - } - else - assertResponseContains("404", response); + response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n"); + assertResponseContains("Directory: /context/dir?/<", response); response = connector.getResponse("GET /context/index.html HTTP/1.0\r\n\r\n"); assertResponseContains("Hello Index", response); @@ -421,7 +414,8 @@ public class DefaultServletTest context.setBaseResource(Resource.newResource(resBase)); File dir = new File(resBase, "dir?"); - assertTrue(dir.mkdirs()); + assumeTrue("FileSystem should support question dirs", dir.mkdirs()); + File index = new File(dir, "index.html"); createFile(index, "

Hello Index

"); @@ -437,7 +431,6 @@ public class DefaultServletTest response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n"); assertResponseContains("Location: http://0.0.0.0/context/dir%3F/index.html", response); } - @Test public void testWelcomeServlet() throws Exception