Package com.scooterframework.common.http

Examples of com.scooterframework.common.http.HTTPResponse


   * Test create() method
   */
  @Test
  public void test_create() {
    String uri = "/comments/create";
    HTTPResponse response = fireHttpGetRequest(uri);
    assertSuccess(response);
  }
View Full Code Here


   * Test <tt>index()</tt> method.
   */
  @Test
  public void test_index() {
    String uri = "/posts";
    HTTPResponse response = fireHttpGetRequest(uri);
    assertSuccess(response);
  }
View Full Code Here

   * Test <tt>crud()</tt> method.
   */
  @Test
  public void test_crud() {
    try {
      HTTPResponse response = null;

      String id = "100";
      Map data = new HashMap();
      data.put("id", id);

      String addURI = "/posts/add";
      response = fireHttpGetRequest(addURI);
      assertSuccess(response);
      log.debug("add response: " + response.getContentAsString());

      String createURI = "/posts";
      response = fireHttpPostRequest(createURI, data);
      assertRedirectSuccess(response);
      log.debug("create response: " + response.getContentAsString());
   
      String showURI = "/posts/" +id;
      response = fireHttpGetRequest(showURI);
      assertSuccess(response);
      log.debug("show response: " + response.getContentAsString());

      String editURI = "/posts/" +id + "/edit";
      response = fireHttpGetRequest(editURI);
      assertSuccess(response);
      log.debug("edit response: " + response.getContentAsString());

      String updateURI = "/posts/" +id;
      response = fireHttpPutRequest(updateURI, data);
      assertRedirectSuccess(response);
      log.debug("update response: " + response.getContentAsString());

      String deleteURI = "/posts/" +id;
      response = fireHttpDeleteRequest(deleteURI);
      assertRedirectSuccess(response);
      log.debug("delete response: " + response.getContentAsString());

    } catch(Exception ex) {
      ex.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of com.scooterframework.common.http.HTTPResponse

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.