Examples of WebRequest


Examples of com.gargoylesoftware.htmlunit.WebRequest

        EasyMock.verify(mockedCodec, resourceCodecData, mockCache);
    }

    public void testVersionedResource() throws Exception {
        WebRequest webRequest = new WebRequest(new URL(
            "http://localhost/rfRes/org.richfaces.resource.VersionedResourceImpl.jsf"));
        WebResponse resourceResponse = webClient.loadWebResponse(webRequest);

        assertEquals(HttpServletResponse.SC_OK, resourceResponse.getStatusCode());
        webRequest = new WebRequest(new URL(
            "http://localhost/rfRes/org.richfaces.resource.VersionedResourceImpl.jsf?v=1_0_2"));
        resourceResponse = webClient.loadWebResponse(webRequest);
        assertEquals(HttpServletResponse.SC_OK, resourceResponse.getStatusCode());
        webRequest = new WebRequest(new URL(
            "http://localhost/rfRes/org.richfaces.resource.VersionedResourceImpl.jsf?v=1_0_3"));
        resourceResponse = webClient.loadWebResponse(webRequest);
        assertEquals(HttpServletResponse.SC_NOT_FOUND, resourceResponse.getStatusCode());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.WebRequest

        String endResourceURL = ".jsf";
        String resourceName = null;
        List<String> resources = populateResourcesToCheck();
        for (String resource : resources) {
            resourceName = baseResourseURL + resource + endResourceURL;
            WebRequest webRequest = new WebRequest(new URL(resourceName));
            WebResponse resourceResponse = webClient.loadWebResponse(webRequest);
            assertEquals(resource, HttpServletResponse.SC_OK, resourceResponse.getStatusCode());
            String expected = readFileAsString(getResourceExpectedOutputFileName(resource));

            assertEquals(resource, unifyWhitespace(expected), unifyWhitespace(resourceResponse.getContentAsString()));
View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    public void testSoapAction()
            throws Exception
    {
        HttpUnitOptions.setLoggingHttpHeaders(true);

        WebRequest req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                                  getResourceAsStream("empty.xml"),
                                                  "text/xml");
        req.setHeaderField("SOAPAction", "one");

        WebResponse response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("oneout") != -1);
      
        req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                       getResourceAsStream("empty.xml"),
                                       "text/xml");
        req.setHeaderField("SOAPAction", "two");
       
        response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("twoout") != -1);

    }
View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    public void testQuotedSoapAction()
            throws Exception
    {
        HttpUnitOptions.setLoggingHttpHeaders(true);

        WebRequest req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                                  getResourceAsStream("empty.xml"),
                                                  "text/xml");
        req.setHeaderField("SOAPAction", "\"one\"");

        WebResponse response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("oneout") != -1);
      
        req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                       getResourceAsStream("empty.xml"),
                                       "text/xml");
        req.setHeaderField("SOAPAction", "\"two\"");
       
        response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("twoout") != -1);

    }
View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    }

    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.
             *
             * @see com.meterware.httpunit.HeaderOnlyWebRequest#getQueryString()
             */
            public String getQueryString()
            {
                return "WSDL";
            }
        };
       
      WebResponse response = newClient().getResponse(getReq);

        WebRequest req = new PostMethodWebRequest("http://localhost/services/EchoImpl",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        response = newClient().getResponse(req);

View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    }

    public void testServlet12()
            throws Exception
    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/EchoImpl",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo12.xml"),
                                                  "text/xml");

        WebResponse response = newClient().getResponse(req);
View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    }
   
    public void testFaultCode()
            throws Exception
    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/BadEcho",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        Transport transport = getXFire().getTransportManager().getTransport(SoapHttpTransport.SOAP11_HTTP_BINDING);
        assertNotNull(transport.getFaultHandlers());
View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    }
    
    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

Examples of com.meterware.httpunit.WebRequest

    }

    public void testAsync()
            throws Exception
    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/AsyncService",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        WebResponse response = newClient().getResponse(req);
        assertTrue(response.getText().length() == 0);
View Full Code Here

Examples of com.meterware.httpunit.WebRequest

    public void testServlet()
            throws Exception
    {
        // Don't do anything because httpunit is b0rked
        WebRequest req = getRequestMessage();
        // WebResponse response = newClient().getResponse(req);

        // NOTE: At this point I would test that the response attachment
        // was sent successfully, but HttpUnit doesn't seem to preserve
        // the content type correctly :-(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.