Package org.mortbay.jetty.testing

Examples of org.mortbay.jetty.testing.HttpTester


        Assert.assertEquals("http://foo.com", requestedURI);
    }

    @Test
    public void testPOSTNothing() throws Exception {
        HttpTester response = doPostRequest("/", "", null);
        Assert.assertEquals(400, response.getStatus());
        assertContains("Invalid POST request", response.getContent());
    }
View Full Code Here


    }

    @Test
    public void testPOSTWorks() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doPostRequest("/", "format=nt&uri=http://foo.com", "application/x-www-form-urlencoded");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com", requestedURI);
        String res = response.getContent();
        assertContains("<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2006/vcard/ns#VCard>", res);
    }
View Full Code Here

    }

    @Test
    public void testPOSTWorksWithParametersOnContentType() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doPostRequest(
                "/",
                "format=nt&uri=http://foo.com",
                "application/x-www-form-urlencoded;charset=UTF-8"
        );
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com", requestedURI);
        String res = response.getContent();
        assertContains(
                "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2006/vcard/ns#VCard>",
                res
        );
    }
View Full Code Here

    }

    @Test
    public void testPOSTBodyWorks() throws Exception {
        String body = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doPostRequest("/nt", body, "text/html");
        Assert.assertEquals(200, response.getStatus());
        String res = response.getContent();
        assertContains(
                "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2006/vcard/ns#VCard>",
                res
        );
        Assert.assertNull(requestedURI);
View Full Code Here

    }

    @Test
    public void testPOSTBodyInParamWorks() throws Exception {
        String body = URLEncoder.encode("<html><body><div class=\"vcard fn\">Joe</div></body></html>", "utf-8");
        HttpTester response = doPostRequest("/", "format=nt&body=" + body,
                "application/x-www-form-urlencoded");
        Assert.assertEquals(200, response.getStatus());
        String res = response.getContent();
        assertContains(
                "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2006/vcard/ns#VCard>",
                res
        );
        Assert.assertNull(requestedURI);
View Full Code Here

    }

    @Test
    public void testPOSTonlyURI() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doPostRequest("/", "uri=http://foo.com", "application/x-www-form-urlencoded");
        Assert.assertEquals(200, response.getStatus());
        String res = response.getContent();
        assertContains("a vcard:VCard", res);
    }
View Full Code Here

        assertContains("a vcard:VCard", res);
    }

    @Test
    public void testPOSTonlyFormat() throws Exception {
        HttpTester response = doPostRequest("/", "format=rdf", "application/x-www-form-urlencoded");
        Assert.assertEquals(400, response.getStatus());
        assertContains("uri", response.getContent());
    }
View Full Code Here

     */
    @Test
    @Ignore
    public void testGETwithURLEncoding() throws Exception {
        content = null;
        HttpTester response = doGetRequest("/best/http://semanticweb.org/wiki/Knud_M%C3%B6ller");
        Assert.assertEquals(200, response.getStatus());
    }
View Full Code Here

     */
    @Test
    @Ignore
    public void testGETwithURLEncodingWithQuery() throws Exception {
        content = null;
        HttpTester response = doGetRequest("/best/http://semanticweb.org/wiki/Knud_M%C3%B6ller?appo=xxx");
        Assert.assertEquals(200, response.getStatus());
    }
View Full Code Here

     */
    @Test
    @Ignore
    public void testGETwithURLEncodingWithFragment() throws Exception {
        content = null;
        HttpTester response = doGetRequest("/best/http://semanticweb.org/wiki/Knud_M%C3%B6ller#abcde");
        Assert.assertEquals(200, response.getStatus());
    }
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.testing.HttpTester

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.