Examples of PostMethodWebRequest


Examples of com.meterware.httpunit.PostMethodWebRequest

     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

Examples of com.meterware.httpunit.PostMethodWebRequest

     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

Examples of com.meterware.httpunit.PostMethodWebRequest

     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

Examples of com.meterware.httpunit.PostMethodWebRequest

    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

Examples of com.meterware.httpunit.PostMethodWebRequest

    public void testHandleExceptionByRedirectURL() 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);
        problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(302));
        //problem.getParameters().put(OAuth2.REDIRECT_URI,"https://client.example.com/cb");
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    public void testHandleExceptionByRedirectURL2() 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);
        problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(302));
        //problem.getParameters().put(OAuth2.REDIRECT_URI,"https://client.example.com/cb");
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

   
     
      for (String[] testCase : OAUTH_PARAMETERS) {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();
        WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );      
        InvocationContext ic = sc.newInvocation( request );     
      
            String label = testCase[0];
            //String realm = testCase[1];
            List<OAuth2.Parameter> parameters = decodeForm(testCase[1]);
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

   
     
      for (String[] testCase : OAUTH_PARAMETERS) {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();
        WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
        request.setParameter( "grant_type", testCase[2] );
        request.setParameter( "client_id", testCase[3] );
        //request.setParameter( "client_secret", testCase[5] );
        request.setParameter( "code", testCase[4] );
        request.setParameter( "redirect_uri", testCase[5] );       
        InvocationContext ic = sc.newInvocation( request );
        OAuth2Message message = OAuth2Servlet.getMessage(ic.getRequest(),"https://test.meterware.com/myServlet");
       
            String label = testCase[0];
            //String realm = testCase[1];
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    @Test
    public void testPutInvocation() throws Exception {
        //Add new item to catalog
        WebConversation wc = new WebConversation();
        WebRequest request   = new PostMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(UPDATED_ITEM.getBytes("UTF-8")),"application/xml");
        WebResponse response = wc.getResource(request);

        Assert.assertEquals(201, response.getResponseCode());
        System.out.println(response.getHeaderField("Location"));

        //read new results and expect to get new item back in the response
        request = new GetMethodWebRequest(SERVICE_URL);
        request.setHeaderField("Content-Type", "application/xml");
        response = wc.getResource(request);

        //for debug purposes
        //System.out.println(">>>" + GET_UPDATED_RESPONSE);
        //System.out.println(">>>" + response.getText());
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    @Test
    public void testPostInvokeServices() throws Exception {
        newClient();
       
        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/greeter",
                getClass().getResourceAsStream("GreeterMessage.xml"),
                "text/xml; charset=UTF-8");
       
        WebResponse response = newClient().getResponse(req);
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.