Package play.mvc.Http

Examples of play.mvc.Http.Response


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

  @Test
  public void actionRedirect_expectOK() {

    final Request req = newRequest();
    req.port = 2003;
    final Response response = GET(req, "/redirector/index?target=Application.hello");
    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

 

  private long timeRedirectRequest(String target){
    long start = System.currentTimeMillis();
    final Request req = newRequest();
    final Response response = GET(req, "/redirector/index?target=" + URLs.encodePart(target));
    assertStatus(302, response);   
    return( System.currentTimeMillis() - start);
  }
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

   
    @Test
    public void testDisableTransaction() {
 
        //make sure isInsideTransaction returns true when actually inside a transaction
        Response response = GET("/Transactional/verifyIsInsideTransaction");
        assertIsOk(response);
        assertEquals("isInsideTransaction: true", getContent(response));
 
        //verify that we can make the controller run without any transaction at all
        response = GET("/Transactional/disabledTransactionTest");
View Full Code Here

    //FIXME Need to fix issue http://play.lighthouseapp.com/projects/57987/tickets/1805-persistenceunit-on-package-not-working
    @Ignore("Wait for fix issue #1805")
    @Test
    public void testMultipleJPASupport() {
        Fixtures.delete(EntityInOtherDb.class);
        Response response = GET("/Transactional/useMultipleJPAConfigs");
        assertIsOk(response);
        assertEquals("ok 1", getContent(response));
       
        // check it again to make sure we don't hang the other db lock
        response = GET("/Transactional/useMultipleJPAConfigs");
View Full Code Here

    @Test
    public void testEditAnEntity() {
  Map<String, String> params = new HashMap<String, String>();
  params.put("entity.date", "2013-10-03 11:33:05:125 AM");
  params.put("entity.yop", "yop");
        Response response = POST(Router.reverse("DataBinding.editAnEntity").url, params);
        assertIsOk(response);
        assertContentMatch("2013-10-03 11:33:05:125 AM", response);
        assertContentMatch("--yop--", response);
    }
View Full Code Here

    @Test
    public void testDispatchAnEntity() {
  Map<String, String> params = new HashMap<String, String>();
  params.put("entity.date", "2013-10-03 11:33:05:125 AM");
  params.put("entity.yop", "yop");
        Response response = POST(Router.reverse("DataBinding.dispatchAnEntity").url, params);
        assertStatus(302, response);
    }
View Full Code Here

TOP

Related Classes of play.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.