Package play.mvc.Http

Examples of play.mvc.Http.Response


    @Test
    public void testEdit() {
  Map<String, String> params = new HashMap<String, String>();
  //params.put("child.father.code", mother.code);

        Response response = POST(Router.reverse("DataBinding.editAnEntity").url, params);
 
    }
View Full Code Here


  Map<String, String> params = new HashMap<String, String>();
  params.put("child.id", child.id.toString());
  params.put("child.father.code", mother.code);
  params.put("child.mother.code", father.code);
  params.put("child.tutor.id", newTutor.getId().toString());
        Response response = POST(Router.reverse("DataBinding.saveChild").url, params);
        assertContentEquals("{\"name\":\"child_2\", \"father\":\"mother\", \"mother\":\"parent\", \"tutor\":\"new_tutor\"}", response);
       
        params.clear();
  params.put("child.id", child.id.toString());
  params.put("child.father", mother.code);
View Full Code Here

  Map<String, String> params = new HashMap<String, String>();
  params.put("child.id", child.id.toString());
  params.put("child.father.code", mother.code);
  params.put("child.mother.code", father.code)
  params.put("child.tutor.id", newTutor.getId().toString());
        Response response = POST(Router.reverse("DataBinding.saveChild").url, params);
     
        assertContentEquals("{\"name\":\"child_2\", \"father\":\"mother\", \"mother\":\"parent\", \"tutor\":\"new_tutor\"}", response);
       
        response = POST(Router.reverse("DataBinding.saveChildAsSecure").url, params);
        assertContentEquals("{\"name\":\"child_2\", \"father\":\"parent\", \"mother\":\"mother\", \"tutor\":\"tutor\"}", response);
View Full Code Here

        Fixtures.deleteAll(); // see Bug #491403
        Fixtures.deleteDirectory("attachments");
        URL deleteURL = reverse(); {
            Binary.deleteAll();
        }
        Response deletedResponse = GET(deleteURL);
        assertStatus(200, deletedResponse);
    }
View Full Code Here

    @Test
    public void testUploadSomething() {
        URL imageURL = reverse(); {
            Binary.showAvatar(1l);
        }
        Response getResponse = GET(imageURL);
        assertStatus(404, getResponse);
       
        URL url = reverse(); {
            Binary.save(null);
        }
        Map<String,String> parameters= new HashMap<String,String>();
        parameters.put("user.username", "username");
        Map<String, File> files= new HashMap<String, File>();
        File f = Play.getFile("test/fond1.png");
        assertTrue(f.exists());
        files.put("user.avatar", f);
        Response uploadResponse = POST(url, parameters, files);
        assertStatus(302, uploadResponse);
        String id = uploadResponse.getHeader("Location").split("=")[1];
        imageURL = reverse(); {
            Binary.showAvatar(new Long(id));
        }
        getResponse = GET(imageURL);
        assertStatus(200, getResponse);
View Full Code Here

        Map<String, File> files= new HashMap<String, File>();
        File file = Play.getFile("test/winie.jpg");
        assertTrue(file.exists());
        files.put("file", file);
        Response uploadResponse = POST("/Binary/uploadFile", parameters, files);

        assertStatus(200, uploadResponse);

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

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

        Map<String, File> files= new HashMap<String, File>();
        File file = Play.getFile("test/winie.jpg");
        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", "1366949", size);
    }
View Full Code Here

        Map<String, File> files= new HashMap<String, File>();
        File file = Play.getFile("test/angel.gif");
        assertTrue(file.exists());
        files.put("file", file);
        Response uploadResponse = POST("/Binary/uploadFile", parameters, files);

        assertStatus(200, uploadResponse);

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

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

        Map<String, File> files= new HashMap<String, File>();
        File file = Play.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

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.