Package com.meterware.httpunit

Examples of com.meterware.httpunit.WebRequest


    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


    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

   
     
      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

   
     
      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

    }
    public void testGetRequestURL() throws Exception
   
      ServletRunner sr = new ServletRunner();
      ServletUnitClient sc = sr.newClient();
        WebRequest request   = new GetMethodWebRequest( "http://test.meterware.com/myServlet" );
        request.setParameter( "color", "red" );
        InvocationContext ic = sc.newInvocation( request );
        String url = OAuth2Servlet.getRequestURL(ic.getRequest());
        assertEquals("URL check", "http://test.meterware.com/myServlet?color=red", url);       
    }
View Full Code Here

   *
   * @throws Exception
   */
  @BeforeClass//TODO add description here
  public static void beforeClass() throws Exception{
    WebRequest req = new GetMethodWebRequest(SERVER_URI+"/ResetGameEngine"); // need to change to what your local host is
    final WebResponse res = WEB_CONVERSATION.getResponse( req )
    assertEquals(
        "the result object should be of DefaultJsonContainer/JsonContainerAdapter",
        "JsonContainerAdapter",
        JsonFactory.fromJson(res.getText()).objectName
View Full Code Here

   */
  @Test //TODO add description here
  public void testGetGames() throws MalformedURLException, IOException, SAXException
  {
   
    WebRequest req = new GetMethodWebRequest(SERVER_URI+"/AvailableGames"); // need to change to what your local host is

    final WebResponse res = WEB_CONVERSATION.getResponse( req );
    res.getResponseMessage();
    //final org.w3c.dom.Document xml = res.getDOM();
    final String response = res.getText();
View Full Code Here

 
  @Test //TODO add description here
  public void testCreateGame() throws MalformedURLException, IOException, SAXException
  {
   
    WebRequest req = new GetMethodWebRequest(SERVER_URI+"/GamePlayers"); // need to change to what your local host is
   
    final WebResponse res = WEB_CONVERSATION.getResponse( req );
    res.getResponseMessage();
    final String response = res.getText().trim();
    jec = GSON.fromJson(response, ExceptionJsonContainer.class);
View Full Code Here

  @Test //TODO add description here
  public void testLoginFailed() throws MalformedURLException, IOException, SAXException
  {
   
    WebRequest req = new GetMethodWebRequest(SERVER_URI+"/Login"); // need to change to what your local host is
   
    final WebResponse res = WEB_CONVERSATION.getResponse( req );
    res.getResponseMessage();
    final String response = res.getText().trim();
   
View Full Code Here

 
  @Test //TODO add description here
  public void testLoginFailed2() throws MalformedURLException, IOException, SAXException
  {
   
    WebRequest req = new GetMethodWebRequest(SERVER_URI+"/Login"); // need to change to what your local host is
    req.setParameter("name", "o");
   
    final WebResponse res = WEB_CONVERSATION.getResponse( req );
    res.getResponseMessage();
    final String response = res.getText().trim();
   
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.