Package com.meterware.httpunit

Examples of com.meterware.httpunit.WebRequest


     * @todo decide on the exception to throw in the servlet, write the
     * test then fix the servlet
     * @throws Exception
     */
    public void testInvalidServiceRaisesError() throws Exception {
        WebRequest request = new GetMethodWebRequest(invalid_service);
        expectErrorCode(request,404);
    }
View Full Code Here


     * A missing wsdl page should be a 404 error; though it is
     * returning 500 as of 2002-08-13
     * @throws Exception
     */
    public void testInvalidServiceWsdlRaisesError() throws Exception {
        WebRequest request = new GetMethodWebRequest(invalid_service+"?wsdl");
        // "The AXIS engine could not find a target service to invoke!");
        expectErrorCode(request,404);

    }
View Full Code Here

    /**
     * test version call
     * @throws Exception
     */
    public void testVersion() throws Exception {
        WebRequest request = new GetMethodWebRequest(services+"/Version?wsdl");
        assertStringInBody(request,"<wsdl:definitions");
    }
View Full Code Here

      setProxyServer(proxy.getExtracted("host"), MCast.toint(proxy.getExtracted("port", "8080"),8080), proxy.getExtracted("user"), proxy.getExtracted("password"));
    }
  }

  public WebResponse request(CaoElement element, String suffix) throws IOException, SAXException {
     WebRequest req = new GetMethodWebRequest( app.getUri(element) + suffix );
     return getResponse( req );
  }
View Full Code Here

     WebRequest req = new GetMethodWebRequest( app.getUri(element) + suffix );
     return getResponse( req );
  }

  public IConfig requestConfig(CaoElement element, String suffix) throws Exception {
     WebRequest req = new GetMethodWebRequest( app.getUri(element) + suffix );
     WebResponse res = getResponse( req );
     if ( res.getResponseCode() != 200 )
       return null;
     String content = res.getText();
     IConfig config = MConfigFactory.getInstance().toConfig(content);
View Full Code Here

     IConfig config = MConfigFactory.getInstance().toConfig(content);
     return config;
  }
 
  public IConfig requestConfig(CaoElement element, String suffix, Map<String, String> post) throws Exception {
     WebRequest req = new PostMethodWebRequest( app.getUri(element) + suffix );
     if (post != null) {
       for (Map.Entry<String, String> entry : post.entrySet())
         req.setParameter(entry.getKey(), entry.getValue());
     }
     WebResponse res = getResponse( req );
     if ( res.getResponseCode() != 200 )
       return null;
     String content = res.getText();
View Full Code Here

     IConfig config = MConfigFactory.getInstance().toConfig(content);
     return config;
  }
 
  public IConfig requestConfig(String path, Map<String, String> post) throws Exception {
     WebRequest req = new PostMethodWebRequest( app.getUri() + path);
     if (post != null) {
       for (Map.Entry<String, String> entry : post.entrySet())
         req.setParameter(entry.getKey(), entry.getValue());
     }

     WebResponse res = getResponse( req );
     if ( res.getResponseCode() != 200 )
       return null;
View Full Code Here

     IConfig config = MConfigFactory.getInstance().toConfig(content);
     return config;
  }
 
  public IConfig requestConfig(String path) throws Exception {
     WebRequest req = new GetMethodWebRequest( app.getUri() + path );
     WebResponse res = getResponse( req );
     if ( res.getResponseCode() != 200 )
       return null;
     String content = res.getText();
     IConfig config = MConfigFactory.getInstance().toConfig(content);
View Full Code Here

     IConfig config = MConfigFactory.getInstance().toConfig(content);
     return config;
  }

  public WebResponse request(String path, Map<String, String> post) throws Exception {
     WebRequest req = new PostMethodWebRequest( app.getUri() + path);
     if (post != null) {
       for (Map.Entry<String, String> entry : post.entrySet())
         req.setParameter(entry.getKey(), entry.getValue());
     }

     return getResponse( req );
  }
View Full Code Here

    public void testHandleExceptionByJson() throws Exception
   
     
        ServletRunner sr = new ServletRunner();
    ServletUnitClient sc = sr.newClient();
    WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
    InvocationContext ic = sc.newInvocation( request );
   
        OAuth2ProblemException problem = new OAuth2ProblemException(OAuth2.ErrorCode.UNSUPPORTED_RESPONSE_TYPE);
        // if you do not specify status code 200 here response does not inluce anything
        problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(200));
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.WebRequest

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.