Package com.meterware.httpunit

Examples of com.meterware.httpunit.GetMethodWebRequest


     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(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

    }
    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

        // --- Execution
        // process the response code later, not via an exception.
        HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );

        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
        WebResponse response = getServletUnitClient().getResponse( request );

        // --- Verification

        switch ( expectation )
View Full Code Here

        // --- Execution
        // process the response code later, not via an exception.
        HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );

        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
        WebResponse response = getServletUnitClient().getResponse( request );

        // --- Verification
        assertResponseOK( response );
        assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );
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.