Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpClient


      getLog().debug("Enter testSessionPassivationWMaxIdle");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();
      clients.add(client);
      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);
     
      // Get the Attribute set
View Full Code Here


      getLog().debug("Enter testSessionPassivationWMaxActive");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();
      clients.add(client);
      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);
     
      // Get the Attribute set; confirm session wasn't deserialized
      String attr0 = checkDeserialization(client, baseURL0_ +getUrl, false);
     
      // passivation-min-idle-time is set to 2 secs, so sleep that
      // long so our session can be passivated
      sleepThread(2100);
     
      // Create enough sessions on server0 to trigger passivation
      // assuming that max-active-sessions is set to 10 in jboss-web.xml
      for (int i = 0; i < 10; i++)
      {
         HttpClient newClient = new HttpClient();
         clients.add(newClient);
         makeGet(newClient, baseURL0_ +setUrl);
         makeGet(newClient, baseURL0_ +getUrl);
      }
     
View Full Code Here

       undeploy(adaptors[1]);
      
       sleep(2000);
         
       // Create an instance of HttpClient.
       HttpClient client = new HttpClient();
       clients.add(client);
      
       // Set the session attribute first
       makeGet(client, baseURL0_ +setUrl);
      
View Full Code Here

 
  public void testCookieSetCorrectly() throws Exception
  {
    log.info("testCookieSetCorrectly");
    URL url = new URL(baseURL+"jbosstest-cookie/CookieReadServlet");
    HttpClient httpClient = new HttpClient();       
    HttpMethodBase request = HttpUtils.createMethod(url,HttpUtils.GET);
    //sending a blank request
    httpClient.executeMethod(request);
   
    log.info("sending request with cookie");   
    request = HttpUtils.createMethod(url,HttpUtils.POST);
    int responseCode = httpClient.executeMethod(request);
    assertEquals(HttpURLConnection.HTTP_OK, responseCode);   
  }
View Full Code Here

  }
 
  public void testCookieRetrievedCorrectly() throws Exception
  {
    URL url = new URL(baseURL+"jbosstest-cookie/CookieServlet");
    HttpClient httpClient = new HttpClient();       
    HttpMethodBase request = HttpUtils.createMethod(url,HttpUtils.GET);      
    int responseCode =httpClient.executeMethod(request);
    //assert that we are able to hit servlet successfully
    assertEquals(HttpURLConnection.HTTP_OK, responseCode);
    request.getResponseHeader("Set-Cookie");
   
    Cookie[] cookies = httpClient.getState().getCookies();       
    //verify that expired cookie is not set by server
    assertTrue("sever did not set expired cookie on client", checkNoExpiredCookie(cookies));
   
    for(int i = 0; i < cookies.length; i++) {
      log.info("Cookie " + i + " : " + cookies[i].toExternalForm());
View Full Code Here

      assertTrue(response.getText().contains("size must be between 2 and"));
   }

   private String getResponseBody(String warName) throws Exception
   {
      HttpClient client = new HttpClient();
      client.executeMethod(makeRequest(warName));
     
      HttpMethodBase result = makeRequest(warName);

      // need to hit it twice with the same session for test to pass
      client.executeMethod(result);

      String responseBody = result.getResponseBodyAsString();
      if (responseBody == null) {
         throw new Exception("Unable to get response from server.");
      }
View Full Code Here

      getLog().debug("Enter testNonPrimitiveGet");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);

      // Create a method instance.
View Full Code Here

      getLog().debug("Enter testNonPrimitiveModify");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);

      // Get the Attribute set
View Full Code Here

      getLog().info("Enter testNonPrimitiveRepeatedModify");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      getLog().info("// Set the session attribute first");
      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);
View Full Code Here

      getLog().debug("Enter testNonPrimitiveRemove");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);

      // Modify a method instance.
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HttpClient

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.