use of com.meterware.servletunit.ServletUnitClient in project v7files by thiloplanz.
the class MiltonServletTest method testCOPYFolder.
public void testCOPYFolder() throws IOException, SAXException {
ServletUnitClient sc = sr.newClient();
sc.setAuthentication("V7Files", "admin", "admin");
{
WebRequest request = new MkColWebRequest("http://test/myServlet/1");
WebResponse resp = sc.getResponse(request);
assertEquals(HttpServletResponse.SC_CREATED, resp.getResponseCode());
}
{
WebRequest request = new PutMethodWebRequest("http://test/myServlet/1/test.txt", new ByteArrayInputStream("testPUT".getBytes()), "text/plain");
WebResponse resp = sc.getResponse(request);
assertEquals(HttpServletResponse.SC_CREATED, resp.getResponseCode());
}
{
WebRequest request = new CopyWebRequest("http://test/myServlet/1", "/myServlet/2");
WebResponse resp = sc.getResponse(request);
assertEquals(HttpServletResponse.SC_CREATED, resp.getResponseCode());
}
assertExists(sc, "http://test/myServlet/2/test.txt");
}
use of com.meterware.servletunit.ServletUnitClient in project v7files by thiloplanz.
the class MiltonServletTest method testCOPYFile.
public void testCOPYFile() throws IOException, SAXException {
ServletUnitClient sc = sr.newClient();
sc.setAuthentication("V7Files", "admin", "admin");
prepareMockData("test.v7files.files", new BasicBSONObject("_id", new ObjectId()).append("filename", "a.txt").append("parent", "webdav").append("in", "abcd".getBytes()));
{
WebRequest request = new CopyWebRequest("http://test/myServlet/a.txt", "/myServlet/b.txt");
WebResponse resp = sc.getResponse(request);
assertEquals(HttpServletResponse.SC_CREATED, resp.getResponseCode());
}
assertGET(sc, "http://test/myServlet/a.txt", "abcd");
assertGET(sc, "http://test/myServlet/b.txt", "abcd");
}
Aggregations