Package com.meterware.httpunit

Examples of com.meterware.httpunit.GetMethodWebRequest


    }

    public void testServlet()
            throws Exception
    {
      WebRequest getReq = new GetMethodWebRequest("http://localhost/services/EchoImpl?wsdl")
        {

            /*
             * Work around bug 1212204 in httpUnit where as of 1.6 there was not
             * a way to support query strings with null values.
View Full Code Here


    }
    
    public void testServiceWsdlNotFound()
            throws Exception
    {
        WebRequest req = new GetMethodWebRequest("http://localhost/services/NoSuchService?wsdl");

        expectErrorCode(req, 404, "Response code 404 required for invalid WSDL url.");
    }
View Full Code Here

        try {
            if (this.webConv == null)
                this.webConv = new WebConversation();

            // Access the URL
            WebRequest wreq = new GetMethodWebRequest(this.url);
            WebResponse wresp = this.webConv.getResponse(wreq);
            int responseCode = wresp.getResponseCode();
            if (responseCode >= 400)
                throw new IOException("Failed with status " + responseCode);
            InputStream inContent = wresp.getInputStream();
View Full Code Here

        Logger.init(Logger.FULL_DEBUG, System.out, true);
        Launcher winstone = new Launcher(args);

        // Check for a simple connection
        WebConversation wc = new WebConversation();
        WebRequest wreq = new GetMethodWebRequest(
                "http://localhost:10003/examples/CountRequestsServlet");
        WebResponse wresp = wc.getResponse(wreq);
        InputStream content = wresp.getInputStream();
        assertTrue("Loading CountRequestsServlet", content.available() > 0);
        content.close();
View Full Code Here

        Logger.init(Logger.FULL_DEBUG, System.out, true);
        Launcher winstone = new Launcher(args);

        // Check for a simple connection
        WebConversation wc = new WebConversation();
        WebRequest wreq = new GetMethodWebRequest(
                "http://localhost:10004/examples/CountRequestsServlet");
        WebResponse wresp1 = wc.getResponse(wreq);
        WebImage img[] = wresp1.getImages();
        for (int n = 0; n < img.length; n++)
            wc.getResponse(img[n].getRequest());
View Full Code Here

        Logger.init(Logger.FULL_DEBUG, System.out, true);
        Launcher winstone = new Launcher(args);

        // Check for a simple connection
        WebConversation wc = new WebConversation();
        WebRequest wreq = new GetMethodWebRequest(
                "http://localhost:10005/examples/TestWriteAfterServlet");
        WebResponse wresp1 = wc.getResponse(wreq);
        Logger.logDirectMessage(Logger.INFO, "log", "Output: " + wresp1.getText(), null);
        assertTrue(wresp1.getText().endsWith("Hello"));
        winstone.shutdown();
View Full Code Here

   {
      String baseURL = HttpUtils.getBaseURL();
      WebConversation webConversation = new WebConversation();
     
      // Initial JSF request
      WebRequest req = new GetMethodWebRequest(baseURL + "bundled-myfaces-hellojsf/index.faces");
      WebResponse webResponse = webConversation.getResponse(req);
      assertTrue(webResponse.getText().contains("Enter your name"));

      // submit data
      WebForm form = webResponse.getFormWithID("form1");
View Full Code Here

    }


    private void doTestGet(String context, String expectedReponsePattern) throws Exception {
        ServletUnitClient client = runner.newClient();
        WebRequest request = new GetMethodWebRequest(BASE_URL + CONTEXT_PATH + context);
        request.setHeaderField("Accept", "text/plain");

        verify(client.getResponse(request), 200, expectedReponsePattern);
    }
View Full Code Here

        return jndi;
    }

    @Test
    public void testServletProducerGet() throws Exception {
        WebRequest req = new GetMethodWebRequest(CONTEXT_URL + "/services/users/123/basic");
        ServletUnitClient client = newClient();
        client.setExceptionsThrownOnErrorStatus(false);
        WebResponse response = client.getResponse(req);

        assertEquals(200, response.getResponseCode());
View Full Code Here

    }
   
    @Test
    public void testServletPojoGet() throws Exception {
       
        WebRequest req = new GetMethodWebRequest(CONTEXT_URL + "/services/users/lives");
        ServletUnitClient client = newClient();
        client.setExceptionsThrownOnErrorStatus(false);
        WebResponse response = client.getResponse(req);

        assertEquals(200, response.getResponseCode());
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.GetMethodWebRequest

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.