Removing GzipTester.assertIsResponseNotGzipCompressed

This commit is contained in:
Joakim Erdfelt 2014-11-10 17:58:38 -07:00
parent f8e431da1f
commit e83df11eaf
2 changed files with 14 additions and 20 deletions

View File

@ -502,16 +502,25 @@ public class GzipFilterDefaultTest
public void testIsNotGzipCompressedHttpStatus() throws Exception
{
GzipTester tester = new GzipTester(testingdir, compressionType);
tester.setGzipFilterClass(testFilter);
// Add Gzip Filter first
FilterHolder gzipHolder = new FilterHolder(testFilter);
gzipHolder.setAsyncSupported(true);
tester.addFilter(gzipHolder,"/*",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
gzipHolder.setInitParameter("mimeTypes","text/plain");
// Test error code 204
FilterHolder holder = tester.setContentServlet(HttpStatusServlet.class);
holder.setInitParameter("mimeTypes","text/plain");
tester.setContentServlet(HttpStatusServlet.class);
try
{
tester.start();
tester.assertIsResponseNotGzipCompressed("GET",-1, 204);
HttpTester.Response response = tester.executeRequest("GET","/context/",2,TimeUnit.SECONDS);
assertThat("Response status", response.getStatus(), is(HttpStatus.NO_CONTENT_204));
assertThat("Content-Encoding",response.get("Content-Encoding"),not(containsString(GzipFilter.GZIP)));
}
finally
{
@ -541,6 +550,7 @@ public class GzipFilterDefaultTest
HttpTester.Response response = tester.executeRequest("GET","/context/",2,TimeUnit.SECONDS);
assertThat("Response status", response.getStatus(), is(HttpStatus.BAD_REQUEST_400));
assertThat("Content-Encoding",response.get("Content-Encoding"),not(containsString(GzipFilter.GZIP)));
String content = tester.readResponse(response);
assertThat("Response content", content, is("error message"));

View File

@ -461,22 +461,6 @@ public class GzipTester
return response;
}
/**
* Asserts that the request results in a properly structured GzipFilter response, where the content is not compressed, and the content-length is returned
* appropriately.
*
* @param expectedFilesize
* the expected filesize to be specified on the Content-Length portion of the response headers. (note: passing -1 will disable the Content-Length
* assertion)
* @throws Exception
*/
public void assertIsResponseNotGzipCompressed(String method, int expectedFilesize, int status) throws Exception
{
String uri = "/context/";
HttpTester.Response response = executeRequest(method,uri);
assertResponseHeaders(expectedFilesize,status,response);
}
private void assertResponseHeaders(int expectedFilesize, int status, HttpTester.Response response)
{
Assert.assertThat("Response.status",response.getStatus(),is(status));