Package yalp.mvc.Http

Examples of yalp.mvc.Http.Response


        Map<String, File> files= new HashMap<String, File>();
        File file = Yalp.getFile("test/angel.gif");
        assertTrue(file.exists());

        files.put("upload", file);
        Response uploadResponse = POST("/Binary/upload", parameters, files);

        assertStatus(200, uploadResponse);

        String size = uploadResponse.getHeader("Content-Length");

        assertEquals("Size does not match", "2440", size);
    }
View Full Code Here


//        assertEquals("Size does not match", "2440", size);
//    }

    @Test
    public void testGetBinaryWithCustomContentType() {
        Response response = GET("/binary/getBinaryWithCustomContentType");
        assertIsOk(response);
        assertContentType("custom/contentType", response);
    }
View Full Code Here

    // Tests to check whether input streams to renderBinary are closed.

    @Test
    public void testGetEmptyBinary() {
        Response response = GET("/binary/getEmptyBinary");
        assertIsOk(response);
        assertTrue(Binary.emptyInputStreamClosed);
    }
View Full Code Here

        assertTrue(Binary.emptyInputStreamClosed);
    }

    @Test
    public void testGetErrorBinary() {
        Response response = GET("/binary/getErrorBinary");
        // This does not work. See Lighthouse ticket #1637.
        // assertStatus(500, response);
        assertTrue(Binary.errorInputStreamClosed);
    }
View Full Code Here

  }
    }

  private void assertValidTest(String remoteAddress, String xForwardedFor) {
    Request request = getRequest(remoteAddress, xForwardedFor);
    Response response = GET(request, PAGE_URL);
    assertIsOk(response);
   
    //remoteAddress should be changed to xForwardedFor address
    assertEquals(xForwardedFor, request.remoteAddress);
  }
View Full Code Here

  }

  private void assertInvalidTest(String remoteAddress, String xForwardedFor) {
    try {
      Request request = getRequest(remoteAddress, xForwardedFor);
      Response response = GET(request, PAGE_URL);
      fail("XForwarded request should have thrown a runtime exception.");
    } catch (RuntimeException re) {
      assertTrue(re.getMessage().contains(remoteAddress));
    }
  }
View Full Code Here

public class RedirectTest extends FunctionalTest {

    @Test
    public void redirectHttp_expectOk() {

        final Response response = GET("/redirector/index?target=http://google.com");
        assertStatus(302, response);
        final String location = response.headers.get("Location").value();

        assertEquals("http://google.com", location);
View Full Code Here

    // prove fix of [#1557] - also support non-http redirects
    @Test
    public void redirectFtp_expectOk() {

        final Response response = GET("/redirector/index?target=ftp://google.com");
        assertStatus(302, response);
        final String location = response.headers.get("Location").value();

        assertEquals("ftp://google.com", location);
View Full Code Here

    @Test
    public void redirectrelative_expectOk() {
        final Request req = newRequest();
        req.port = 2003;
        final Response response = GET(req, "/redirector/index?target=/someurl");
        assertStatus(302, response);
        final String location = response.headers.get("Location").value();

        // note: only works if port is not 80
        // in that case relative url is returned for ease of testing
View Full Code Here

public class TransactionalJPATest extends FunctionalTest {
   
    @Test
    public void testImport() {
        Response response = GET("/Transactional/readOnlyTest");
        assertIsOk(response);
        response = GET("/Transactional/echoHowManyPosts");
        assertIsOk(response);
        assertEquals("There are 0 posts", getContent(response));
    }
View Full Code Here

TOP

Related Classes of yalp.mvc.Http.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.