Package com.google.sitebricks.client

Examples of com.google.sitebricks.client.WebResponse


*/
@Test(suiteName = AcceptanceTest.SUITE)
public class RestfuWebServiceAcceptanceTest {

  public void shouldTransportJsonWithoutTemplate() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/service")
        .transports(String.class)
        .over(Json.class)
        .get();
View Full Code Here


        }
      });
  }

  public void shouldRedirect() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/service")
        .transports(String.class)
        .over(Text.class)
        .post("");
View Full Code Here

    assertRedirectResponse(response);
  }

  public void shouldTransportJsonWithoutTemplateNoAnnotations() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/no_annotations/service")
        .transports(String.class)
        .over(Json.class)
        .get();
View Full Code Here

    assertBookResponse(response);
  }

  public void shouldRedirectNoAnnotations() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/no_annotations/service")
        .transports(String.class)
        .over(Text.class)
        .post("");
View Full Code Here

  public void create() {
    String url = AcceptanceTest.baseUrl() + RestfulWebServiceWithCRUDConversions.AT_ME;
    System.out.println("POST " + url);

    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(Widget.class)
      .over(Json.class)
      .post(testWidget);

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(testWidget);
  }
View Full Code Here

  }

  public void readCollection() {
    String url = AcceptanceTest.baseUrl() + RestfulWebServiceWithCRUDConversions.AT_ME;
    System.out.println("GET " + url);
    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(String.class)
      .over(Json.class).get();

    @SuppressWarnings("unchecked")
    List<Widget> result = response.to(List.class).using(Json.class);

    assert result.size() == RestfulWebServiceWithCRUDConversions.widgets.size();
  }
View Full Code Here

  }

  public void readIndividual() {
    String url = AcceptanceTest.baseUrl() + RestfulWebServiceWithCRUDConversions.AT_ME + "/" + widgetOne.getId();
    System.out.println("GET " + url);
    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(String.class)
      .over(Json.class)
      .get();

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(widgetOne);
  }
View Full Code Here

    String url = AcceptanceTest.baseUrl() + RestfulWebServiceWithCRUDConversions.AT_ME;

    widgetOne.setPrice(5.50);
    System.out.println("PUT " + url);

    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(Widget.class)
      .over(Json.class)
      .put(widgetOne);

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(widgetOne);
  }
View Full Code Here

  public void delete() {
    create()// create, then delete.
    String url = AcceptanceTest.baseUrl() + RestfulWebServiceWithCRUDConversions.AT_ME + "/" + testWidget.getId();
    System.out.println("DELETE " + url);
    WebResponse response = createInjector()
      .getInstance(Web.class)
      .clientOf(url)
      .transports(String.class)
      .over(Json.class)
      .delete();

    Widget result = response.to(Widget.class).using(Json.class);
    assert result.equals(testWidget);
  }
View Full Code Here

    perdido.setAuthor(RestfulWebService.CHINA_MIEVILLE);
    perdido.setName(RestfulWebService.PERDIDO_STREET_STATION);
    perdido.setPageCount(RestfulWebService.PAGE_COUNT);


    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.baseUrl() + "/postable?p1=v1,v2")
        .transports(RestfulWebService.Book.class)
        .over(Json.class)
        .post(perdido);

    // Should ping us the author back.
    assert response.toString().contains(perdido.getAuthor()) : response.toString();
  }
View Full Code Here

TOP

Related Classes of com.google.sitebricks.client.WebResponse

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.