Package org.mortbay.jetty.testing

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


        assertContains("Invalid format", response.getContent());
    }

    @Test
    public void testGETInvalidURI() throws Exception {
        HttpTester response = doGetRequest("/xml/mailto:richard@cyganiak.de");
        Assert.assertEquals(400, response.getStatus());
        assertContains("Invalid input URI", response.getContent());
    }
View Full Code Here


    }

    @Test
    public void testGETWorks() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doGetRequest("/nt/foo.com/bar.html");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com/bar.html", 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 testPost () throws Exception {

        final HttpTester request = new HttpTester();
        final HttpTester response = new HttpTester();

        request.setMethod("GET");
        request.setHeader("Host", "tester");
        request.setVersion("HTTP/1.0");
        request.setURI("/");

        response.parse(tester.getResponses(request.generate()));
        final String stats = response.getContent();

        System.out.println(stats);

    }
View Full Code Here

        tester = null;
    }

    @Test
    public void testGETOnlyFormat() throws Exception {
        HttpTester response = doGetRequest("/xml");
        Assert.assertEquals(404, response.getStatus());
        assertContains("Missing URI", response.getContent());
    }
View Full Code Here

        assertContains("Missing URI", response.getContent());
    }

    @Test
    public void testGETWrongFormat() throws Exception {
        HttpTester response = doGetRequest("/dummy/foo.com");
        Assert.assertEquals(400, response.getStatus());
        assertContains("Invalid format", response.getContent());
    }
View Full Code Here

        assertContains("Invalid format", response.getContent());
    }

    @Test
    public void testGETInvalidURI() throws Exception {
        HttpTester response = doGetRequest("/xml/mailto:richard@cyganiak.de");
        Assert.assertEquals(400, response.getStatus());
        assertContains("Invalid input URI", response.getContent());
    }
View Full Code Here

    }

    @Test
    public void testGETWorks() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doGetRequest("/nt/foo.com/bar.html");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com/bar.html", 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 testGETAddsHTTPScheme() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doGetRequest("/nt/foo.com");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com", requestedURI);
    }
View Full Code Here

    }

    @Test
    public void testGETIncludesQueryString() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doGetRequest("/nt/http://foo.com?id=1");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com?id=1", requestedURI);
    }
View Full Code Here

    }

    @Test
    public void testGETwithURIinParam() throws Exception {
        content = "<html><body><div class=\"vcard fn\">Joe</div></body></html>";
        HttpTester response = doGetRequest("/nt?uri=http://foo.com?id=1");
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("http://foo.com?id=1", requestedURI);
    }
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.