Exemplo n.º 1
0
  /**
   * 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 expectedResponse the expected response body string
   * @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 assertIsResponseNotGzipCompressedAndEqualToExpectedString(
      String expectedResponse, int expectedFilesize, int status) throws Exception {
    String uri = "/context/";
    HttpTester response = executeRequest(uri);
    assertResponseHeaders(expectedFilesize, status, response);

    String actual = readResponse(response);
    Assert.assertEquals("Expected response equals actual response", expectedResponse, actual);
  }
Exemplo n.º 2
0
  /**
   * Asserts that the requested filename results in a properly structured GzipFilter response, where
   * the content is not compressed, and the content-length is returned appropriately.
   *
   * @param filename the filename used for the request, and also used to compare the response to the
   *     server file, assumes that the file is suitable for {@link Assert#assertEquals(Object,
   *     Object)} use. (in other words, the contents of the file are text)
   * @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 filename, int expectedFilesize, int status)
      throws Exception {
    String uri = "/context/" + filename;
    HttpTester response = executeRequest(uri);
    assertResponseHeaders(expectedFilesize, status, response);

    // Assert that the contents are what we expect.
    if (filename != null) {
      File serverFile = testdir.getFile(filename);
      String expectedResponse = IO.readToString(serverFile);

      String actual = readResponse(response);
      Assert.assertEquals("Expected response equals actual response", expectedResponse, actual);
    }
  }
Exemplo n.º 3
0
 /**
  * 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(int expectedFilesize, int status) throws Exception {
   String uri = "/context/";
   HttpTester response = executeRequest(uri);
   assertResponseHeaders(expectedFilesize, status, response);
 }