Package org.mortbay.jetty.testing

Examples of org.mortbay.jetty.testing.HttpTester$PH


     */
    @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


    }

    @Test
    public void testCorrectBaseURI() throws Exception {
        content = "@prefix foaf: <http://xmlns.com/foaf/0.1/> . <> a foaf:Document .";
        HttpTester response = doGetRequest("/nt/foo.com/test.n3");
        Assert.assertEquals(200, response.getStatus());
        assertContains("<http://foo.com/test.n3>", response.getContent());
    }
View Full Code Here

    }

    @Test
    public void testDefaultBaseURIinPOST() throws Exception {
        String body = "@prefix foaf: <http://xmlns.com/foaf/0.1/> . <> a foaf:Document .";
        HttpTester response = doPostRequest("/nt", body, "text/rdf+n3;charset=utf-8");
        Assert.assertEquals(200, response.getStatus());
        assertContains("<" + Servlet.DEFAULT_BASE_URI + ">", response.getContent());
    }
View Full Code Here

    }

    @Test
    public void testPOSTwithoutContentType() throws Exception {
        String body = "@prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://example.com/asdf> a foaf:Document .";
        HttpTester response = doPostRequest("/nt", body, null);
        Assert.assertEquals(400, response.getStatus());
        assertContains("Content-Type", response.getContent());
    }
View Full Code Here

    }

    @Test
    public void testPOSTwithContentTypeParam() throws Exception {
        String body = URLEncoder.encode("<http://foo.bar> <http://foo.bar> <http://foo.bar> .", "utf-8");
        HttpTester response = doPostRequest("/", "format=nt&body=" + body + "&type=application/x-foobar",
                "application/x-www-form-urlencoded");
        Assert.assertEquals(415, response.getStatus());
    }
View Full Code Here

        Assert.assertEquals(415, response.getStatus());
    }

    @Test
    public void testPOSTbodyMissingFormat() throws Exception {
        HttpTester response = doPostRequest(
                "/",
                "<html><body><div class=\"vcard fn\">Joe</div></body></html>", "text/html"
        );
        Assert.assertEquals(200, response.getStatus());
        String res = response.getContent();
        assertContains("a vcard:VCard", res);
    }
View Full Code Here

    }

    @Test
    public void testContentNegotiationDefaultsToTurtle() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doGetRequest("/best/http://foo.com");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com", requestedURI);
        assertContains("a vcard:VCard", response.getContent());
    }
View Full Code Here

    @Test
    public void testContentNegotiationForWildcardReturnsTurtle() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        acceptHeader = "*/*";
        HttpTester response = doGetRequest("/best/http://foo.com");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com", requestedURI);
        assertContains("a vcard:VCard", response.getContent());
    }
View Full Code Here

    @Test
    public void testContentNegotiationForUnacceptableFormatReturns406() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        acceptHeader = "image/jpeg";
        HttpTester response = doGetRequest("/best/http://foo.com");
        Assert.assertEquals(406, response.getStatus());
        Assert.assertNull(requestedURI);
    }
View Full Code Here

    @Test
    public void testContentNegotiationForTurtle() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        acceptHeader = "text/turtle";
        HttpTester response = doGetRequest("/best/http://foo.com");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com", requestedURI);
        assertContains("a vcard:VCard", response.getContent());
    }
View Full Code Here

TOP

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

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.