made test more robust

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2807 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-02-21 06:34:02 +00:00
parent 014b43a3d7
commit b91027275f
2 changed files with 17 additions and 10 deletions

View File

@ -33,7 +33,6 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -64,7 +63,6 @@ public class PutFilter implements Filter
Set<String> _operations = new HashSet<String>();
private ConcurrentMap<String,String> _hidden = new ConcurrentHashMap<String, String>();
private String _options=null;
private ServletContext _context;
private String _baseURI;

View File

@ -133,8 +133,15 @@ public class PutFilterTest
int l = to_send.length();
out.write(to_send.substring(0,l-10).getBytes());
out.flush();
Thread.sleep(100);
out.write(to_send.substring(l-10,l-5).getBytes());
out.flush();
// loop until the resource is hidden (ie the PUT is starting to
// read the file
do
{
Thread.sleep(100);
// test GET
@ -143,6 +150,8 @@ public class PutFilterTest
request.setHeader("Host","tester");
request.setURI("/context/file.txt");
response.parse(tester.getResponses(request.generate()));
}
while(response.getStatus()==200);
assertTrue(response.getMethod()==null);
assertEquals(HttpServletResponse.SC_NOT_FOUND,response.getStatus());